javascript - Time Graph in Flot issue? -


i trying graph month out in flot (per day) or possibly every other day, have tick.

to time values, doing this:

$date = strtotime($rowdata[0]); // 2013-01-01 $mydata = json_encode(array($date*1000, 1234)); // echo out array javascript var. 

for reason, can change line: minticksize: [1, day] 2 (label every other tick think) , nothing change. also, time values not showing well? doing wrong?

here jsfiddle

here update every 2 days...is there rendering issue? also, why oct 10, date shown? : jsfiddle update

here have far javascript goes:

var mydata = [[1380603600000,0],[1380690000000,0],[1380776400000,0],[1380862800000,0],[1380949200000,0],[1381035600000,0],[1381122000000,0],[1381208400000,0],[1381294800000,0],[1381381200000,0],[1381467600000,0],[1381554000000,0],[1381640400000,1],[1381726800000,0],[1381813200000,0],[1381899600000,0],[1381986000000,0],[1382072400000,0],[1382158800000,0],[1382245200000,0],[1382331600000,0],[1382418000000,0],[1382504400000,0],[1382590800000,0],[1382677200000,0],[1382763600000,0],[1382850000000,0],[1382936400000,0],[1383022800000,0],[1383109200000,0],[1383195600000,0]];  var plot = $.plot($(".subschart"),    [ { data: mydata, label: "mydata"} ], {    series: {        lines: { show: true,                 linewidth: 2,                 fill: true, fillcolor: { colors: [ { opacity: 0.5 }, { opacity: 0.2 } ] }              },        points: { show: true,                   linewidth: 2               },        grow: { active: true,                  steps: 30              },        shadowsize: 0    },    grid: { hoverable: true,             clickable: true,             tickcolor: "#ddd",            borderwidth: 1,            bordercolor: "#ddd"          },    colors: ["#ff0000"],     xaxis: {mode: "time", timeformat: "%b %m", ticks: mydata, minticksize: [5, "day"]},      yaxis: {ticks:3, tickdecimals: 0},     tooltip: true,  }); 

update

when remove ticks: mydata option, labels show up, of them on same date? also, none of points land on dates.

as @smokie suggested, need remove ticks option. when provide ticks, flot skips tick generation , uses provided instead, in case invalid.

once that, you'll notice have labels, show oct. 10. that's because date format %b (short month name) %m (month number). i'd guess want %b %d.

note won't tick every day because, depending on size of window, wouldn't fit. that's why minticksize minimum rather exact value; flot ensure @ least 1 day (or many specify) separates ticks, may choose spread them out further ensure fit.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -