Google 可视化 - 带注释的时间线图例

发布于 2024-09-08 19:09:09 字数 299 浏览 1 评论 0原文

我有一个带注释的时间线图表,可以通过 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 技术交流群。

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

发布评论

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

评论(1

风渺 2024-09-15 19:09:09

尝试使用 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.

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