I have these in my data1.csv. The left column is time and the right column is the data. I would like to display time on x-axis and the data on y-axis on flot chart.
09:35,13
10:35,12
11:35,38
12:35,12
13:35,11
14:35,10
15:35,43
16:35,42
17:35,39
18:35,45
I have done the function to load my data and no problem there.
function graphUpdate() {
$.ajax({
url : "file/data1.csv",
type : "GET",
dataType : "text",
success : oncsvReceived
});
}
Now my problem is to display those time on x-axis on flot charts as you can see below. Anyone is able to help me here? Tried reading the documentation and looking around here, it doesn’t help me much. I would be very grateful for your help.
function oncsvReceived(data) {
var alltext = $.csv()(data);
$.plot($("#placeholder"), [alltext], {
yaxis: {
},
xaxis:{
});
You have to use the time plugin for flot and set
modeastimeSee doc: https://github.com/flot/flot/blob/master/API.md#customizing-the-axes
update :
A few months ago, I used it by downloading separately. But I am not sure about the latest version. Please see API.txt to check whether there is any change.
link: https://github.com/flot/flot/blob/master/jquery.flot.time.js