I am "animating" diagrams over time by changing the data and redrawing them.
// initialization
var data = ...
var targetPlot = $.jqplot('#diagram', data, diagramOptions);
Now after some time I will change the data in some way and want to update the diagram. The following solution works:
// update Data
targetPlot.data = ...;
// remove old diagram
$('#<%= "diagram" + diagram.id.to_s %>container').empty();
// redraw
targetPlot = $.jqplot('#diagram', data, diagramOptions);
Bit this is a complete redraw. With lots of data and a short intervall jQPlot takes much memory and the diagram is flickering.
How to do this correct?
The solution using the redraw-function for me only draws the old diagram:
// update Data
targetPlot.data = ...;
targetPlot.redraw();