gpt4 book ai didi

javascript - 实时图表上的动态 x 轴?

转载 作者:行者123 更新时间:2023-11-30 10:06:38 25 4
gpt4 key购买 nike

有没有办法更新实时图表上的 x 轴?

我想要这样的东西 -> ( http://www.flotcharts.org/flot/examples/realtime/index.html )但如您所见,x 轴上没有任何值。

那么,有没有办法在图表移动时移动 x 轴值?

提前致谢!

最佳答案

您首先需要显示 x 轴:

var plot = $.plot("#placeholder", [ getRandomData() ], {
xaxis: {
show: true
}
});

然后在每次数据更新时,您也需要更新网格:

function update() {
plot.setData([getRandomData()]);
plot.setupGrid(); // updating the grid
plot.draw();
setTimeout(update, updateInterval);
}

检查 this plunker例如。

关于javascript - 实时图表上的动态 x 轴?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28786521/

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