问题描述
你好,
是否有可能将通过Javascript获得的值显示为条形图?
如果,是的,我们会感激一下指向如何执行此操作或某些
示例代码。
干杯,
Geoff
hello,
Is it possible to present values gained via Javascript as a bar chart?
If, yes, wouild appreciate a pointer to how to do this or to some
sample code.
Cheers,
Geoff
推荐答案
也许这样的事情可以让你开始:
var data = [[''jan'',104] ,[''feb'',99],[''mar'',111]];
document.write(''< table border =" 0">< tr> ;'');
for(var i = 0; i< data.length; ++ i)
document.write(''< td align =" ; center" valign =" bottom">''
+ data [i] [1]
+''< div style =" background:red ;宽度:20px;高度:''
+ data [i] [1] +''px">& nbsp;< / div>''
+ data [i] [0] +''< / td>'');
document.write(''< / tr>< / table>'');
-
巴特
Maybe something like this could get you started:
var data = [ [''jan'', 104], [''feb'', 99], [''mar'', 111] ];
document.write(''<table border="0"><tr>'');
for (var i=0; i<data.length; ++i)
document.write(''<td align="center" valign="bottom">''
+ data[i][1]
+ ''<div style="background:red;width:20px;height:''
+ data[i][1] + ''px"> </div>''
+ data[i][0]+''</td>'');
document.write(''</tr></table>'');
--
Bart
这样的事情可能会让你开始:
var data = [[''jan'',104],['' feb'',99],[''mar'',111]];
document.write(''< table border =" 0">< tr>'') ;
for(var i = 0; i< data.length; ++ i)
document.write(''< td align =" center" valign =" bottom">''
+ data [i] [1]
+''< div style =" background:red; width:20px ;高度:''
+ data [i] [1] +''px">& nbsp;< / div>''
+ data [ i] [0] +''< / td>'');
document.write(''< / tr>< / table>'');
Maybe something like this could get you started:
var data = [ [''jan'', 104], [''feb'', 99], [''mar'', 111] ];
document.write(''<table border="0"><tr>'');
for (var i=0; i<data.length; ++i)
document.write(''<td align="center" valign="bottom">''
+ data[i][1]
+ ''<div style="background:red;width:20px;height:''
+ data[i][1] + ''px"> </div>''
+ data[i][0]+''</td>'');
document.write(''</tr></table>'');
非常感谢Bart!
干杯
Geoff
Many thanks Bart!
Cheers
Geoff
< URL:http://www.merlyn.demon.co.uk/js-misc1.htm#BC>。它使用大小的
DIV,因此可以使用屏幕的分辨率。它适用于IE,
Safari,Opera和Firefox;但是在Firefox中它需要稍微调整。
-
(c)John Stockton,nr London UK。 [email protected] DOS 3.3,6.20; WinXP。
Web< URL:http://www.merlyn.demon.co.uk/- FAQqish topics,acronyms&链接。
PAS EXE TXT ZIP via< URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
我的DOS< ;网址:http://www.merlyn.demon.co.uk/batfiles.htm-也是batprogs.htm。
<URL:http://www.merlyn.demon.co.uk/js-misc1.htm#BC>. It uses sized
DIVs, so works with the resolution of the screen. It works in IE,
Safari, Opera, and Firefox; but in Firefox it needs a little adjustment.
--
(c) John Stockton, nr London UK. [email protected] DOS 3.3, 6.20; WinXP.
Web <URL:http://www.merlyn.demon.co.uk/- FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm- also batprogs.htm.
这篇关于制作条形图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!