javascript - jquery flot pointing on wrong place -
i have gone through alot of questions through stackoverflow none me. trying generate graph through jquery flot legend placed on wrong place.
here's screenshot of graph. data thursday displaying near friday.
here's javascript code
var plot = $.plot("#chart_widget", [ { data: issued, label: "issued" }, { data: released, label: "released" }, ], $.extend(true, {}, plugins.getflotdefaults(), { series: { lines: { fill: false, linewidth: 1.5 }, points: { show: true, radius: 4, linewidth: 1.1 }, grow: {active: true, growings: [{stepmode: "maximum"}]} }, grid: { hoverable: true, clickable: true }, xaxis: { mode: "time", minticksize: [1, "day"], daynames: ["sun", "mon", "tue", "wed", "thu", "fri", "sat"], timeformat: "%a", ticklength: 0 }, tooltip: true, tooltipopts: { content: '%s: $%y' } }) );
here's screenshot of data through ajax request , assign above variables.
here's plunker http://plnkr.co/edit/aysgpk9eq84l55t5rogq?p=preview
the datapoint tooltip in image on thursday, @ 2 pm:
(new date(1437660070000)).toutcstring() "thu, 23 jul 2015 14:01:10 gmt"
so nearer friday tick on axis thursday tick (the ticks @ midnight).
if day important graph can change timestamps @ midnight , align ticks on axis. do this, can use code this:
for (var = 0; < issued.length; i++) { issued[i][0] = issued[i][0] - (issued[i][0] % 86400000); }
see updated plunker.
Comments
Post a Comment