destroy()

Removes the StockChart references internally, thus making the StockChart eligible for garbage collection.

Example: stockChart.destroy();
Note:
  • stockChart.destroy() should be called before using the same variable to hold a newly allocated object / StockChart to prevent memory leaks.
var stockChart = new CanvasJS.StockChart("container",
{
 .
 .
 .
 .
});
stockChart.render();

stockChart.destroy();
stockChart = null;

Try Editing The Code

  Also See:    


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