jQuery使用TimeStamp属性flot数据

时间:2012-09-11 02:55:00

标签: javascript jquery jquery-plugins flot

无法在浏览器中显示flot数据

   var plot = $.plot($("#placeholder"),
    [{ data: capacityList, label: "Capacity(MsgNumber/min)"}],
        {
        series:
           {
               lines: { show: true },
               points: { show: true }
           },
        crosshair: { mode: "x" },
        grid: { hoverable: true, clickable: true },
        yaxis: {
            axisLabel: "MsgNumber",
            min: 0
        },
        xaxis: {
            axisLabel: "Time",
            mode: "time",
            timeformat: "%H:%M",
            tickSize: 1000 * 60 * 60
        }
    });

capacityList是一个数组,一个元素是一个具有属性DatetimeStamp & MsgNumber

的对象
capacityList[12]
Object
DatetimeStamp: 1345681620000
MsgNumber: 15

1 个答案:

答案 0 :(得分:2)

只需传递一对x,y对的数组。然后将在x参数上调用xaxis时间函数,该参数是时间戳。

capacityList = [[1345681620000,15]]

http://people.iola.dk/olau/flot/examples/time.html