【发布时间】:2015-05-01 10:21:05
【问题描述】:
有没有办法更新实时图表上的 x 轴?
我想要这样的东西 -> (http://www.flotcharts.org/flot/examples/realtime/index.html) 但如您所见,x 轴上没有值..
那么,有没有办法在图表移动时移动 x 轴值?
提前致谢!
【问题讨论】:
标签: javascript jquery charts real-time flot
有没有办法更新实时图表上的 x 轴?
我想要这样的东西 -> (http://www.flotcharts.org/flot/examples/realtime/index.html) 但如您所见,x 轴上没有值..
那么,有没有办法在图表移动时移动 x 轴值?
提前致谢!
【问题讨论】:
标签: javascript jquery charts real-time flot
你首先需要显示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 为例。
【讨论】: