Google图表 - 在值为零时不显示点数 [英] Google Charts - don't show points when value is zero
问题描述
我正在使用Google Charts显示一些时间序列数据,如下所示。通常,数据具有高比例的零值,因此您可以沿x轴获得许多点。我认为这会使图表看起来混乱,我想不显示y = 0的点。
I'm using Google Charts to show some timeseries data like that shown below. Typically the data has a high proportion of zero values so you get lots of points sitting along the x-axis. I think this makes the chart look cluttered and I'd like to not show points where y=0.
任何想法/指针都非常赞赏。
Any ideas / pointers much appreciated.
谢谢,
ct
推荐答案
如果您不希望它具有实际值之间的所有点,则可以从数据中完全删除值。在价值之后保持前0点,在价值再次之前保持0点。
If you don't want it to have all the points between the real values you can completely remove the values from your data. Keep the first 0 point right after the value and 0 point right before you have values again.
这个:
[1000, 12],
[1001, 16],
[1002, 0],
[1003, 0],
[1004, 0],
[1005, 0],
[1006, 4],
[1007, 2],
[1008, 0],
[1009, 14]
成为:
[1000, 12],
[1001, 16],
[1002, 0],
[1005, 0],
[1006, 4],
[1007, 2],
[1008, 0],
[1009, 14]
这应该只显示1002处的零点和1005处的零点以及它们之间没有点的线。
This should only show a zero point at 1002 and one at 1005 and a line with no points between them.
这篇关于Google图表 - 在值为零时不显示点数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!