【问题标题】:Dynamic x-axis on a real-time flot chart?实时图表上的动态 x 轴?
【发布时间】:2015-05-01 10:21:05
【问题描述】:

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

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

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

提前致谢!

【问题讨论】:

    标签: javascript jquery charts real-time flot


    【解决方案1】:

    你首先需要显示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 为例。

    【讨论】:

    • 这很有帮助。谢谢你:)
    猜你喜欢
    • 1970-01-01
    • 2015-10-18
    • 1970-01-01
    • 2018-06-24
    • 1970-01-01
    • 1970-01-01
    • 2016-01-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多