Flot not displaying x axis labels correctly

axisflottime

I have to display a graph with date on the X axis and Amt on the Y axis. There will be 8 lines (series) each with n months data.
When I plot the graph I am sending in 6 months data for sure.( one line's data is shown below)

[1251701950000, 34.50553]
[1254294030000, 27.014463]
[1256972350000, 26.7805]
[1259567970000, 33.08871]
[1262246430000, 51.987762]
[1264924750000, 56.868233]

However the graph shows up like this http://twitpic.com/1gbb7m

The first months label is missing and last month is not aligned correctly, my flot js code is as follows

$.plot($("#lgdGraphTab"),graphData, { 
  xaxis: { 
    mode: "time",  
    timeformat: "%b-%y",
    monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
    minTickSize: [1, "month"]
  },
  yaxis : {
    tickSize: 5 
  },
  series: {
    lines: { show: true , shadowSize:0},
    points: { show: true }
  },
  legend:{  
    container: $('#legendArea'),
    noColumns:8
  },
  clickable: true,
  hoverable: true           
});

Best Answer

All of the timestamps in your data hold the last day of each month rather than the 1st. I believe this is the cause of your problem.

Related Topic