Google 图表 API - 同一张图像上的多个图表

发布于 2024-09-11 11:24:57 字数 603 浏览 1 评论 0原文

有没有办法使用 Google Charts api 在同一张图像上显示多个图表?

详细说明: 我有一个数据系列,我想将其显示为条形图。 我有另一个数据集,与第一个数据集无关(它们是相关的,但值大一百倍)。 X 轴代表日期。 我想要将第二个数据集显示为折线图,Y 轴位于左侧。

我在“复合图表”部分找到了类似的内容,但据我了解,标记是根据已显示的数据集计算的 - 我想让它们独立。

换句话说 - 是否可以制作这样的图像: http://chart.apis.google.com/chart?cht=bvg&chm=D,0033FF,1,0,5,1& chs=200x150&chd=t1:30,10,20|60,40,50&chxt=y

但线是独立的,并且它们的值轴位于右侧。

抱歉,我不熟悉这些术语 - 我确信我想要实现的目标有一个名称。 谢谢!

Is there a way to display multiple charts on the same image using Google Charts api?

To elaborate:
I have one data series which I want to display as bar chart.
I have another data set which has nothing to do with the first one (well they are correlated but the values are hundred times bigger).
X-axis is for dates.
I want to have second data set displayed as line chart with Y-axis on the left.

I found something similar in "Compound charts" section but as far as I understand markers are calculated based on already displayed data set - and I want to have them independent.

In other words - is it possible to make image like this:
http://chart.apis.google.com/chart?cht=bvg&chm=D,0033FF,1,0,5,1&chs=200x150&chd=t1:30,10,20|60,40,50&chxt=y

but with the line being independent and their values axis being on the right.

I'm sorry I'm not familiar with the terminology - I'm sure there is a name for what I'm trying to achieve.
Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

旧时浪漫 2024-09-18 11:24:57

仅落后曲线 2 年,但只是为了让您知道我已经实现了针对 2 个不同轴刻度显示 2 个数据集(一个是条形图,另一个是折线图)的目标。

问题在于缩放参数 &chds 以及使用 &chxr 的显式轴值。本质上,我定义了 x 轴、y 轴和 r 轴的显式比例。然后指示缩放参数以不同的方式缩放每个数据集。

因此,对于 0 - 10 之间的 r 数据集和 0-2 之间的 y 数据集,我会这样写:

&chds=0,2,0,10 (y 然后 r 在我的轴参数中定义,即 &chxt=y,r
...和...
&chxr=0,0,2|1,0,10

如果您需要更多详细信息,请告诉我!

Only 2 years behind the curve but just to let you know that I have achieved your objective of displaying 2 datasets (one a bar chart, the other a line chart) against 2 different axis scales.

The devil is in the scaling parameter &chds and explicit axis values using &chxr. Essentially, I defined the explicit scales for the x-axis, y-axis and r-axis. and then instructed the scaling parameter to scale each dataset differently.

So for an r dataset between 0 - 10 and a y dataset between 0-2 I would write;

&chds=0,2,0,10 (y then r defined in my axis parameter, i.e. &chxt=y,r)
...and...
&chxr=0,0,2|1,0,10

Let me know if you need more detail!

顾忌 2024-09-18 11:24:57

我之前研究过类似的东西,并且经常使用谷歌图表 API。我90%肯定答案是否定的。抱歉:(

I've looked into something similar to this before and have used the google chart API a lot. I'm 90% sure the answer is no. Sry :(

帅哥哥的热头脑 2024-09-18 11:24:57

是的,这是可能的。

以下是在同一轴上显示两个数据集的示例。 1是条形图,另一个是折线图......

此行 - chd=t1:95,1,1,3,10,3,77|95,52,44,24,11,2,1 - 允许两个数据集。

懒惰型

Yep it is possible.

Here is an example of two datasets displayed on the same axes. 1 is a bar chart the other is a line graph....

This line - chd=t1:95,1,1,3,10,3,77|95,52,44,24,11,2,1 - allows for the two datasets.

slothistype

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