如何使用Google图表绘制折线图
为什么该线从 y 轴 100 开始,任何人都可以解决我的问题吗?
代码:
<img src="http://chart.apis.google.com/chart?
chs=500x200
&chd=t:533,100,423,200|179,50
&cht=lc
&chxt=x,y
&chxl=0:|JAN|FEB|MAR|APR|MAY|JUNE|JULY|AUG|SEP|OCT|NOV|DEC|
1:||20|40|60|80|100
&chco=FF9900,FF0000,0000FF"
alt="Sample chart" />
如果我更改 y 轴值,该线将变为 1000!
1:||200|400|600|800|1000
我怎样才能得到533这个起点?
谢谢
Why the line is starting at 100 on y-axis, Can any body solve my problem.
code:
<img src="http://chart.apis.google.com/chart?
chs=500x200
&chd=t:533,100,423,200|179,50
&cht=lc
&chxt=x,y
&chxl=0:|JAN|FEB|MAR|APR|MAY|JUNE|JULY|AUG|SEP|OCT|NOV|DEC|
1:||20|40|60|80|100
&chco=FF9900,FF0000,0000FF"
alt="Sample chart" />
if i changed the y-axis values the line is coming at 1000!
1:||200|400|600|800|1000
how can i get that starting point at 533 ?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
轴 1 是左 y 轴,使用 chxl 参数您指定了 0、20、40、60、80 和 100 的标签。
您可以将顶部值更改为 533,但我认为这会看起来很奇怪。
需要意识到的是,标签的工作独立于值。 您可以使用
chds
参数更改数据的比例。所以我认为您应该在 Y 轴标签上指定一个舍入值,例如 600 并缩放数据以匹配。
尝试这个:
Axis 1 is the left y-Axis and with the
chxl
parameter you have specified labels of 0,20,40,60,80 and 100.You could change the top value to 533 but I think this would look odd.
The thing to realise is that the labels work independently of the values. You change the scale of your data using the
chds
parameter.So I think you should specify a round value on the Y-axis label like 600 and scale the data to match.
Try this:
所有 Google 图表均按 100 的比例表示。因此最高值将始终位于图表顶部。
当您将轴指定为 20,40,60,80,100 时,现在看起来好像您的顶部值为 100,但实际上,无论您有什么值,它总是看起来像 100,因为它会沿着顶部运行。
删除轴设置,或调整轴值以表示值中的最大值。 在本例中为 533。
All Google charts are represented proportionally to 100. So the highest value will always run along the top of the graph.
As you have specified your axis as 20,40,60,80,100 it now looks as though your top value is 100, but actually, whatever value you have, it will always look like 100 as it will run along the top.
Either remove the axis settings, or adjust your axis values to represent the maximum value in your values. In this case 533.