Google 可视化 - 带注释的时间线图例
我有一个带注释的时间线图表,可以通过 ajax 获取新数据。它工作正常,新的点出现,我重新绘制图表。我的图表有两条线,因此顶部的图例中有两个标签。无论出于何种愚蠢的原因,每次重新绘制图表时,图例标签都会交换位置!所以它会说
• Foo 5.2 • Bar 3.6
然后我将刷新(并且不会有新数据,因此对重绘的调用与前一个100%相同),现在它说
• Bar 3.6 • Foo 5.2
In当然,分别是红色和蓝色。究竟是什么拥有小程序来执行此操作?有什么方法可以控制图例标签的顺序吗?我在官方文档中找不到任何相关信息。
I have an annotated timeline chart that gets new data over ajax. It's working fine, new points come in and I redraw the graph. My graph has two lines, so there are two labels in the legend on top. For whatever stupid reason, every single time the graph is redrawn, the legend labels swap places! So it will say
Foo 5.2 Bar 3.6
And then I'll refresh (and there will be no new data, so the call to redraw is 100% identical to the previous one) and now it says
Bar 3.6 Foo 5.2
In the respective red and blue, of course. What on earth would possess the applet to do this? Is there any way I can control the order of legend labels? I couldn't find anything about it in the official documentation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 google.visualization.DataTable。例如:
dataTable = new google.visualization.DataTable({cols:graphColumns, rows:graphRows});
chart = new google.visualization.AnnotatedTimeLine($('#chart_div')[0]);
chart.draw(dataTable)
我以这种方式使用它,并且我的图例值没有任何问题。
Try using google.visualization.DataTable. For example:
dataTable = new google.visualization.DataTable({cols:graphColumns, rows:graphRows});
chart = new google.visualization.AnnotatedTimeLine($('#chart_div')[0]);
chart.draw(dataTable)
I use it this way and don't have any problems with my legend values.