如何使用浮图自定义时间格式


how to customize time format with flotchart

>我有一个通过ajax调用并作为json数组返回的数据的flot这是我的很多

var 选项 = { 行:{ 显示:真 }, 积分: { 显示:真 }, x轴:{ 刻度小数: 0, 刻度大小: 1, 模式:"时间", 时间格式:"%H:%M:%S" } }; 变量数据 = []; var 占位符 = $("#realtime");

    $.plot(placeholder, data, option);
    var alreadyFetched = {};
    $(document).ready(function () {
        data = [];
        alreadyFetched = {};
        $.plot(placeholder, data, option);
        function fetchData() {
            function onDataReceived(series) {
                data = [ series ];
                $.plot($("#realtime"), data, option);
            }
            $.ajax({
                url: "../data.php",
                method: 'GET',
                dataType: 'json',
                success: onDataReceived
            });
            function update() {
                plot.setData([ getRandomData() ]);
                // since the axes don't change, we don't need to call plot.setupGrid()
                plot.draw();
                setTimeout(update, 1000);
            }
            update();
        }
        setTimeout(fetchData, 1000);
    });

这是我返回的 JSON

{"label":"Activation","data":[
                               ["08:53:14","10"],["08:53:15","9"],["08:53:16","9"],
                               ["08:53:17","20"],["08:53:18","6"],["08:53:23","16"],
                               ["08:53:24","12"],["08:53:25","14"],["08:53:26","22"],
                               ["08:53:27","20"],["08:53:28","10"],["08:53:29","19"],
                               ["08:53:30","13"],["08:53:31","9"],["08:53:32","12"],
                               ["08:53:34","12"],["08:53:35","17"],["08:53:36","6"],
                               ["08:53:37","14"],["08:53:38","22"],["08:53:39","43"],
                               ["08:53:40","34"],["08:53:41","27"],["08:53:42","31"],
                               ["08:53:43","2"],["08:53:44","1"],["08:53:45","86"],
                               ["08:53:46","82"],["08:53:47","4"],["08:53:48","7"],
                               ["08:53:49","6"],["08:53:50","18"],["08:53:51","17"],
                               ["08:53:52","15"],["08:53:53","3"],["08:53:54","14"],
                               ["08:53:55","2"],["08:53:56","8"],["08:53:57","14"],
                               ["08:53:58","9"],["08:53:59","5"]
                          ]
 }

图表为空。我认为我的时间格式有问题。有人可以帮忙吗?谢谢

如果要

使用mode: 'time'则必须按照文档中的说明在数据中放置时间戳。