You are on the right track with draw
and setupGrid
, here's what you need to do:
var plot = $.plot($('#placeholder'),data,options);
//time passes, you now want to replot
var newData = [[0,2],[1,3],[2,5]];
plot.setData(newData);
plot.setupGrid(); //only necessary if your new data will change the axes or grid
plot.draw();
Alternatively, it's not too much worse to just re-call $.plot
. The above way is more efficient, but...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…