gpt4 book ai didi

javascript - D3 实时流图(图形数据可视化)

转载 作者:行者123 更新时间:2023-12-02 22:47:25 26 4
gpt4 key购买 nike

我想要一个流图,如下例所示: http://mbostock.github.com/d3/ex/stream.html

enter image description here

但我希望实时数据从右侧输入,旧数据从左侧离开,这样我总是有一个包含 200 个样本的窗口。我该如何做到这一点才能实现适当的转换?

我尝试更改数组 a 中的数据点,然后重新创建一个区域

  data0 = d3.layout.stack()(a);

但是我的转换并没有让图表看起来像是在屏幕上滑动。

提前致谢。

最佳答案

尝试this tutorial :

When implementing realtime displays of time-series data, we often use the x-axis to encode time as position: as time progresses, new data comes in from the right, and old data slides out to the left. If you use D3’s built-in path interpolators, however, you may see some surprising behavior...

To eliminate the wiggle, interpolate the transform rather than the path. This makes sense if you think of the chart as visualizing a function—its value isn’t changing, we’re just showing a different part of the domain. By sliding the visible window at the same rate that new data arrives, we can seamlessly display realtime data...

关于javascript - D3 实时流图(图形数据可视化),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9664642/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com