destroy()

Removes the chart references internally, thus making the chart eligible for garbage collection, in turn clearing up the memory.

Example: chart.destroy();
Notes:
  • On calling chart.destroy(), chart won’t be responsive unless new chart is created.
  • chart.destroy() should be called before using the same variable to hold a newly allocated object/chart to prevent memory leaks.
var  chart =  new  CanvasJS("container",
{
    .
    .
    .
    .
});
chart.render();

chart.destroy();
chart = null;

Try Editing The Code

  Also See:    


If you have any questions, please feel free to ask in our forums.Ask Question