为什么NVD3 StreamGraph会随着时间推移将y零轴移位?

安贾普

链接到带有倾斜图的样本图像

在此处输入图片说明

链接到NVD3 Streamgraph页面

在此处输入图片说明

nvd3流图将随时间急剧下降或上升。我搜索了SO和NVD3文档,但没有找到控制每个时间点y轴零位置的变量。我也没有找到对此的讨论。换句话说,是什么使整个图形在一个方向或另一个方向倾斜,以及如何控制或关闭该倾斜。

我阅读了拜伦关于流线图的一些初始论文,但无法弄清楚,以为我会在这里问。

Could someone please point me towards documentation on this or otherwise provide insight?

AmeliaBR

The NVD3 code for the stacked area chart accepts four possibilities for the chart style: stack, stream, stream-center, and expand. The default stream graph is the "stream" style, and this is the version that gets off-centre if you have any zero values in your data.

If you set the style explicitly to "stream-center", the chart behaves as expected. However, the radio buttons that switch between display styles switch back to the problematic algorithm, so they will need to be disabled.

chart.style('stream-center')
     .showControls(false);

It's possible that the existence of this other display algorithm means that the NVD3 folks are working on it. The github issue page might be a good place to look for updates or responses from them:

https://github.com/novus/nvd3/issues/416

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章