如何让 Google Charts 在散点图中显示多种颜色?

发布于 2024-07-05 12:48:23 字数 68 浏览 12 评论 0原文

我想在 Google Chart 散点图中显示数据点的多种颜色(以及可能的形状和大小)。 有人有如何执行此操作的示例吗?

I would like to display multiple colors (and potentially shapes and sizes) of data points in a Google Chart scatter chart. Does anyone have an example of how to do so?

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

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

发布评论

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

评论(4

二智少女 2024-07-12 12:48:23

您只能在散点图中使用一个数据集,因此只能使用一种颜色。

http://code.google.com/apis/chart/#scatter_plot

< em>来自 API 描述:

散点图使用多个数据集的方式与其他图表类型不同。 您只能在散点图中显示一组数据。

You can only use one dataset in a scatter plot, thus only one color.

http://code.google.com/apis/chart/#scatter_plot

From the API description:

Scatter plots use multiple data sets differently than other chart types. You can only show one data set in a scatter plot.

淡看悲欢离合 2024-07-12 12:48:23

您可以使用带有白线和彩色形状的线图来有效地伪造多色散点图标记在您想要显示的点上。

You could effectively fake a multi-color scatter plot by using a line plot with white lines and colored shape markers at the points you want to display.

↘紸啶 2024-07-12 12:48:23

这是另一个示例:Twitter 图表。 我希望能做同样的事情。 需要找出如何做同心圆。

Here's another example: twitter charts. I'm hoping to do the same thing. Need to find out how to do the concentric circles.

第几種人 2024-07-12 12:48:23

在等待几秒钟的答案后,我回答了我自己的问题:-)

您确实可以为不同的数据元素设置不同的颜色。 例如:

http://chart.apis.google.com/chart?chs=300x200&cht=s&chd=t :1,2,3|6,5,4&chds=1,3,0,10&chxt=x,y&chxl=0:|0|1|2|1:|0|10&chm=d ,ff0000,0,0,8,0|a,ff8080,0,1,42,0|c,ffff00,0,2,16,0

chm= 发挥了魔力。 我试图有多个 chm= 语句。 您只需要一个,但有多个描述,并用竖线分隔。

I answered my own question after waiting SECONDS for an answer here :-)

You can indeed have different colors for different data elements. For example:

http://chart.apis.google.com/chart?chs=300x200&cht=s&chd=t:1,2,3|6,5,4&chds=1,3,0,10&chxt=x,y&chxl=0:|0|1|2|1:|0|10&chm=d,ff0000,0,0,8,0|a,ff8080,0,1,42,0|c,ffff00,0,2,16,0

It's the chm= that does the magic. I was trying to have multiple chm= statements. You need to have just one, but with multiple descriptions separated by vertical bars.

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