Reputation: 34281
I have an existing graph created with Dygraphs based on a JavaScript array. I also have a process that generates new values, say once per second, as JavaScript array.
Is it possible to add the new values to the existing graph? I'd like to avoid redrawing the whole graph each time a new value is created.
var data = [[1,99,42],[2,98,52]]
var graph = new Dygraph(element, data, {});
// now graph is created and visible
// how to add newPoint to existing graph?
var newPoint = [3,100,20];
Upvotes: 0
Views: 1224
Reputation: 34281
You can use option file
for all kinds of data, not just for CSV files.
data.push(newPoint);
graph.updateOptions({file: data});
Upvotes: 2