javascript - FLOT Chart xAxis time -
i using flot chart charts. please find following...
js array
data_visits = [ [new date('06/02/2014 01:00').gettime(), 100], [new date('06/05/2014 10:00').gettime(), 200], [new date('06/10/2014 13:00').gettime(), 300], [new date('06/15/2014 15:00').gettime(), 400], ];
chart code
if($('#flot_overview').length) { var chart_placeholder = $('#flot_overview'); var options = { grid: { clickable: true, hoverable: true, autohighlight: true, backgroundcolor: null, borderwidth: 0, color: "#666", labelmargin: 10, axismargin: 0, mouseactiveradius: 10, minbordermargin: 5 }, series: { lines: { show: true, linewidth: 2, steps: false, fill: true }, points: { show:true, radius: 4, symbol: "circle", fill: true } }, tooltip: true, tooltipopts: { content: "<span style='display:block; padding:7px;'>%x - <strong style='color:yellow;'>%y</strong></span>", xdateformat: "%b %d, %y %h:%m", shifts: { x: 20, y: 0 }, defaulttheme: false }, xaxis: { mode: "time", minticksize: [1, "hour"], timeformat: '%h:%m', labelwidth: "40" }, yaxis: { min: 0 }, legend: { nocolumns: 0, position: "ne" }, colors: ["#0892cd"], shadowsize: 0 }; $.plot(chart_placeholder,[{ label: "click / visits", data: data_visits, points: {fillcolor: '#fff'}, lines: {fillcolor: 'rgba(8,146,205,.2)'} }],options); }
it generates chart , shows correct time in tooltip, not show correct time in xaxis per settings, show 00:00
xaxis if use timeformat: '%h:%m'
works fine if format date.
please help, thanks.
since data spans multiple days, flot logically placing tick marks @ the start each day. means time format of '%h:%m'
, 0:00.
in mind this makes lot more sense data.
Comments
Post a Comment