Reputation: 1278
I want to plot a bar char in real time (the data is updated every one second). My bar chart should plot the previous and the new added data every time there is a new data point appears. I have perviously plotted histogram, scatter plot using flot. They all worked out well. I don't understand why this is not working now.
I don't have any error. When I debug I see that my data is correct.
Sample of my code is
var options = {
series: {
bars:{show:true}
}};
$(document).ready(function() {
chart1 = $.plot($("#placeholder"),
[{
data: new_data,
xaxis: {ticks:8,minTickSize: 1},
yaxis: {min:-1,max:3,tickSize:1},
grid: { borderWidth: 1 }
}],options)
});
Thank you for any suggestion!
Upvotes: 0
Views: 1111
Reputation: 1278
I figured out the problem. I was storing my data in different format. I was suppose to send new_data
to plot function like [[0, 1], [1200, 1], [2400, 0], [3600, 1]];
rather I was sending it like [0, 1], [1200, 1], [2400, 0], [3600, 1]
.
Upvotes: 1