Does anyone know how to display the date in flot based on timestamp
I use this:
var options = {
lines: { show: true },
points: { show: true },
xaxis: { mode: "time", timeformat: "%m/%d/%y", minTickSize: [1, "day"]}
};
I guess all you need to do is to multiply the timestamp (which look like unix timestamps) by 1000.
Unix timestamp tracks time as a running total of seconds starting from January 1st, 1970. While javascript timestamps measure milliseconds. So just multiply by 1000 and you should be fine
Try defining the 'timeformat' attribute, and define the pattern that flot will use to format the millisecond value.
xaxis:{
mode: "time",
timeformat: "%M:%S"
},
I just ran into this and I think we both used the same bad Flot example. The signature is:
var plot = $.plot(placeholder, data, options)
And your code is doing something like
var plot = $.plot(placeholder, data, xoptions, yoptions)
So to fix it, just do this instead:
$.plot(
$("#placeholder"),
[{data:d1,lines:{show: true},label:"Mountain"},{data:d2,lines:{show:true},label:"Valley"}],
{yaxis: {label:"cm"}, xaxis: {mode:"time"}}
);