$(function () { var data1 = [[new Date("2010/08/26"), 0], [new Date("2010/08/27"), 10], [new Date("2010/08/28"), 3], [new Date("2010/08/29"), 1], [new Date("2010/08/30"), 4] ];
var options = {
lines: {
show: true,
fill: true,
fillColor: "rgba(247, 233, 228, 0.6)"
},
points: { show: true },
xaxis: {
mode: "time",
minTickSize: [1, "day"],
timeformat: "%y/%m/%d"
},
yaxis: {
min: 0,
tickSize:1,
tickDecimals: 0
},
grid: {
borderColor: "rgb(114, 114, 116)"
},
colors: [ "rgb(182, 90, 24)" ]
};
$.plot($("#placeholder1"), [{ data: data1 }], options);
});
Note that all points are not marked in the right places (like 10px to right). Someone had the same problem?
- graph.png 18KB
Comment #1
Posted on Sep 28, 2011 by Happy PandaComment deleted
Comment #2
Posted on Sep 28, 2011 by Happy Pandatry: xaxis: { mode: "time", //minTickSize: [1, "day"], //timeformat: "%y/%m/%d" }, It's because UTC time using in Flot. And all your Date ,if time in your machine not like GMT-0, get change. For example my time is UTC+04:00, and flot get 2010/08/26 - 4 hours and show me first point in 2010/08/25 20:00 !
If your want to fix it, replace all 'UTC' to '' (ex. getUTCSeconds to getSeconds) in jquery.flot.js !
Comment #3
Posted on Sep 28, 2011 by Helpful CamelThanks a lot! Perfect!
Comment #4
Posted on Feb 2, 2012 by Swift BearThanks
Comment #5
Posted on Apr 30, 2012 by Happy Wombat(No comment was entered for this change.)
Comment #6
Posted on Jul 12, 2012 by Swift RhinoComment deleted
Comment #7
Posted on Jul 12, 2012 by Swift RhinoI have done exactly the same by removing the UTC string, but still the x-axis is not aligned with the plotted point. I have even tried the last version of flot with the time flot library, and still the same and using timezone: "browser". This is my options array: var options = { series: { lines: { show: true }, points: { show: true } }, grid: { hoverable: true, clickable: true }, xaxis: { mode: "time", timeformat: "%d/%m", tickSize: [1, "day"] }, yaxis: { min: 0 }, legend: { show: false }, selection: { mode: "x" }
};
and the data is a simple new Date(someDateArray[i])).getTime().
Is there any other work around this phenomenon?
Comment #8
Posted on Jul 12, 2012 by Swift RhinoI fixed this by using the function Date.UTC(year,month,day,...)!!
Comment #9
Posted on Aug 21, 2013 by Massive Camelusing this option
timezone:"browser"
Comment #10
Posted on May 25, 2015 by Quick Camelthis is very good !
Status: Invalid
Labels:
Type-Defect
Priority-Medium