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 it Yourself by Editing the Code below.


  Also See:    



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