Google Charts - 如何拥有轴标签和值?
我目前正在使用 Google Charts 在 XY 折线图上显示 2 行数据。我已经快完成了,但我需要在 X 轴和 Y 轴上都贴上标签。
沿着垂直 Y 轴,我想用“分钟”替换 0 到 100,沿着水平 X 轴,我想用“小时”替换 0 到 100。
我已经折腾了很多年了,只是无法弄清楚这个小事情。这是我目前的代码。有人可以救我的大脑免于融化吗?这是我的代码,以便您可以查看图表,谢谢。
<img src="http://chart.apis.google.com/chart
?chxr=0,0,24|1,0,60
&chxt=x,y,x,y
&chs=800x350
&cht=lxy
&chco=3072F3,FF0000
&chds=0,24,0,60,0,24,0,60
&chd=t:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23|20,30,40,20,30,40,20,30,40,20,30,40,20,30,40,20,30,40,20,30,40,20,30,40|
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23|5,10,22,35,5,10,22,35,5,10,22,35,5,10,22,35,5,10,22,35,5,10,22,35
&chdl=Active|Sedentary
&chls=2,4,1|1
&chma=5,5,5,25
&chtt=Physical+Activity+Chart"
width="800" height="350" alt="Physical Activity Chart" />
I am currently working on displaying 2 lines of data on a XY linechart using Google Charts. I have it nearly finished but I need to put labels on both the X and Y axis.
Along the vertical Y axis I want to replace the 0 to 100 with 'Minutes' and along the horizontal X axis I want to replace the 0 to 100 with 'Hours'.
I have been messing around with the for ages and can't figure it out just this tiny thing. Here is my current code at the moment. Can someone please save my brain from melting? Here is my code so you can view the chart, thanks.
<img src="http://chart.apis.google.com/chart
?chxr=0,0,24|1,0,60
&chxt=x,y,x,y
&chs=800x350
&cht=lxy
&chco=3072F3,FF0000
&chds=0,24,0,60,0,24,0,60
&chd=t:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23|20,30,40,20,30,40,20,30,40,20,30,40,20,30,40,20,30,40,20,30,40,20,30,40|
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23|5,10,22,35,5,10,22,35,5,10,22,35,5,10,22,35,5,10,22,35,5,10,22,35
&chdl=Active|Sedentary
&chls=2,4,1|1
&chma=5,5,5,25
&chtt=Physical+Activity+Chart"
width="800" height="350" alt="Physical Activity Chart" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我几乎立刻就明白了,痛苦!
不管怎样,我必须添加这段代码,然后它就起作用了,为每个轴标签分配值-
Ok I figured it out almost straight away then, pain!
Anyways, i had to add in this code and it worked then, assigning values to each axis label-