Currently I am creating my bar graph like so.
return (
...
<Bar options={options} data={data} redraw={true} />
...
);
This leads to that I can access and update my graphs data only from this method.
ChartJS.instances[1]
ChartJS.instances[1].data.datasets[0].data[0]
This works fine until I go navigate to my main page and back again to the page that my graph is in, then the charts instance isn't 1 anymore, but 3.
Destroying instance 3 doesn't do anything but create instance number 5.
How do I destroy graphs instance before leaving the page or should I somehow loop through ChartJS.instances and keep updating my data that way?
I have tried destorying ChartJS.instances but without result, and I cannot loop through them either