How do I remove the old chart or reset the data? - RGraph.net support forum

How do I remove the old chart or reset the data?

Post a reply
Posted by Roshni at 10:09 on 5th October 2021
Hello,

I have dropdown of city and onchange I need to reload new chart based on values but the old chart is remain as it is and new values has been ovelapping so can you please let me know what should I do or is there any code to remove or reset chart data.

Posted by Richard at 10:26 on 5th October 2021
What you need to do is remove the old chart from the ObjectRegistry - which is where RGraph keeps track of what objects there on the canvas.

The easiest way to do this is to use the reset() function instead of the clear() function:

var myCanvas = document.getElementById('cvs');

RGraph.reset(myCanvas);

Post a reply

What's your name?
What do you want to say?