Dygraph: how to clear graph data and reload it?

My application has updated functionality in which all current data on the chart must be cleared and data must be loaded from the moment it is launched. I do not want to destroy the digraph and recreate it, but I just need to clear the existing data and the plot from the beginning. I tried

g.rawdata_ = null; g.updateOptions ({'file': g.rawdata _});

But this gives rise to an error. If I set rawdata to 0 and then try to upgrade, it will not clear the data. Any suggestion on how to do this?

+6
source share
1 answer

As the guys in the comments say:

plotData = [[0,0]]; g.updateOptions( { 'file': plotData } ); 

plotData must have something in it. You might be able to host one of several different formats, but the above has worked for me in the past. I am constantly updating the plot and updating the data every second. To do this, I preload plotData just before updateOptions.

Good luck

J

0
source

Source: https://habr.com/ru/post/953914/


All Articles