I get data from database which is formatted using php and returned as JSON response for an Ajax call. Every thing works fine and data is plotted. But if X-Axis contains date then nothing is plotted. I submit a starting and an end date using Ajax. Here is the data, I generate as response:
[
{
"data": [
[
"2014-11-02",
5
],
[
"2014-11-04",
12
],
[
"2014-11-07",
2
],
[
"2014-11-13",
21
]
],
"label": "Label1",
"color": 8
}
]
My x-Axis:
xaxes : [ {
mode : "time",
timeformat : "%y-%m-%d",
color : "black",
axisLabel : "Date",
axisLabelUseCanvas : true,
axisLabelFontSizePixels : 12,
axisLabelFontFamily : 'Verdana, Arial',
axisLabelPadding : 10
}],
I followed the tutorial : http://www.jqueryflottutorial.com/how-to-make-jquery-flot-time-series-chart.html but cannot figure out how to do it with when using data from ajax response.
Also, how can I divide the ticks according to start and end dates automatically?
$.plot(/* your code */)