Google Visualization API 中的正/负图表
我需要生成这样的图表:
具体来说,我想显示正值和负值一个时间段的负值(可以是一小时、一分钟等)并像这样显示。
我可以发誓我在 Google Visualization API Gallery 前几天,但现在找不到了,甚至不知道这种图表叫什么。
首先,你知道这种图表叫什么吗?这样我就可以找到文档?其次,有没有办法用Google Visualization API来实现这样的图表?如果没有,是否有另一种常见的网络图表解决方案可以实现这一目标?
谢谢您的宝贵时间。
I need to generate a chart like this one:
Specifically, I want to show both a positive value and a negative value for a time period (could be an hour, minute, etc.) and display it like this.
I could have sworn I saw something like this on the Google Visualization API Gallery the other day, but I can't find it now, and am not even sure what this kind of chart is called.
First, do you know what this kind of chart is called so I can possibly find documentation? Second, is there any way to implement such a chart with the Google Visualization API? If not, is there another common charting solution for web that I can achieve this with?
Thank you for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这称为“堆叠条形图”,确实可以使用 Google Visualization API 创建。
只需使用“isStacked”属性(此处描述;http://code. google.com/apis/visualization/documentation/gallery/barchart.html)。
这里有一些示例代码(基于 Google 提供的默认条形图示例,并进行了更新以显示 isStacked 的使用以及示例中的一些示例数据);
结果...
This is called a "Stacked Bar Chart", and can indeed be created with the Google Visualisation API.
Simply use the "isStacked" property (described here; http://code.google.com/apis/visualization/documentation/gallery/barchart.html).
Here's some sample code (based off the default bar chart example provided by Google and updated to show the use of isStacked and some sample data from your example);
And the results...
使用柱形图而不是条形图:
https://jsfiddle.net/0rrar9oq/16
Use ColumnChart instead of BarChart:
https://jsfiddle.net/0rrar9oq/16