如何使用Google图表绘制折线图

发布于 2024-07-16 10:22:57 字数 482 浏览 4 评论 0原文

为什么该线从 y 轴 100 开始,任何人都可以解决我的问题吗?

代码:

<img src="http://chart.apis.google.com/chart?
chs=500x200
&amp;chd=t:533,100,423,200|179,50
&amp;cht=lc
&amp;chxt=x,y
&amp;chxl=0:|JAN|FEB|MAR|APR|MAY|JUNE|JULY|AUG|SEP|OCT|NOV|DEC|
1:||20|40|60|80|100
&amp;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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

好倦 2024-07-23 10:22:57

轴 1 是左 y 轴,使用 chxl 参数您指定了 0、20、40、60、80 和 100 的标签。

您可以将顶部值更改为 533,但我认为这会看起来很奇怪。

需要意识到的是,标签的工作独立于值。 您可以使用 chds 参数更改数据的比例

所以我认为您应该在 Y 轴标签上指定一个舍入值,例如 600 并缩放数据以匹配。

尝试这个:

<img src="http://chart.apis.google.com/chart?
chs=500x200
&chd=t:533,100,423,200|179,50
&chds=0,600
&cht=lc
&chxt=x,y
&chxl=0:|JAN|FEB|MAR|APR|MAY|JUNE|JULY|AUG|SEP|OCT|NOV|DEC|
1:|0|300|600
&chco=FF9900,FF0000,0000FF"
alt="Sample chart" />

图

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:

<img src="http://chart.apis.google.com/chart?
chs=500x200
&chd=t:533,100,423,200|179,50
&chds=0,600
&cht=lc
&chxt=x,y
&chxl=0:|JAN|FEB|MAR|APR|MAY|JUNE|JULY|AUG|SEP|OCT|NOV|DEC|
1:|0|300|600
&chco=FF9900,FF0000,0000FF"
alt="Sample chart" />

Graph

书信已泛黄 2024-07-23 10:22:57

所有 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文