For the needs of my application, I create a chart but afterwards I need to change the content of the div element which contains the chart dynamically. So first this div contains a canvas with the chart, then I delete the canvas and I create something else (e.g. a report) and later I need to create again a chart depending on the user’s behavior.
So I have the following part of code:
var myDiagram : go.Diagram;
myDiagram = go.Diagram.fromDiv(record.renderContainer);
myDiagram = new go.Diagram(record.renderContainer);
This code works fine the first time because I create a new Diagram. But after deleting the chart and changing the content of the div, this doesn’t work any more. I don’t get any error, but the chart that I create after this part of code is not actually created.
The problem is that there is already a diagram associated with this div container, but the canvas doesn’t exist any more.
I hope the description of the problem is clear enough :) If not, please let me know.
Any idea is welcome :)
Thanks a lot in advance!