Start Plotting Graph From Right Side
I am plotting a real time graph with flot graphs. $(function () { var data = []; var dataset; var totalPoints = 100; var updateInterval = 1000; var now = new D
Solution 1:
Your time value in the call is too high (1000000 ms = 1000 seconds = ~17 minutes):
setTimeout(update, 1000000);
Also if you wish to start with a full width chart (so that the data will come in from the right), add this after your initial variable declarations to fill the chart with empty points before the measuring starts:
for (var i = 0; i < totalPoints; i++) {
data.push([now - (totalPoints - i) * updateInterval, null]);
}
Also we save the start time and only draw labels for times after the start time where we have data:
tickFormatter: function (v, axis) {
var date = newDate(v);
if (date.getTime() < startDate) {
return"";
} else ...
See this updated fiddle which includes all changes.
Post a Comment for "Start Plotting Graph From Right Side"