My application has refresh functionality in which all the present data on the graph should get cleared and data should be loaded from starting. I don't want to destroy the dygraph and recreate it but just need to clear the existing data and plot from starting. What I tried is
g.rawdata_ = null; g.updateOptions({'file': g.rawdata_});
But it throws the error. If i set rawdata to 0 and then try to update, it doesn't clear off the data. Any suggestion on how to do this?
Just like the guys in the comments are saying:
plotData = [[0,0]];
g.updateOptions(
{
'file': plotData
}
);
plotData has to have something in it. You could probably put one of several different formats, but the above has worked for me in the past. I am live updating a plot as well and refreshing the data every second. To do that, I am preloading the plotData just before the updateOptions.
Good luck,
j
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With