Scott 混合理论
Scott 混合理论

Reputation: 2332

jQuery flot data with TimeStamp property

cant show flot data in browser

   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 is an array, a element is a object with properties DatetimeStamp & MsgNumber:

capacityList[12]
Object
DatetimeStamp: 1345681620000
MsgNumber: 15

Upvotes: 1

Views: 731

Answers (1)

arhea
arhea

Reputation: 454

Just pass an array of arrays with x,y pairs. Then the xaxis time functions will be invoked on the x parameter which is a timestamp.

capacityList = [[1345681620000,15]]

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

Upvotes: 2

Related Questions