16

I'm using the free version of AmCharts, and I have a simple question - how do you delete a Chart after it has been loaded? I've searched the internet, but haven't come up on much.

user3413723
  • 11,147
  • 6
  • 55
  • 64

3 Answers3

26

If you want to destroy the chart object, at all, call:

chart.clear();

and then null the chart variable:

chart = null;
svarog
  • 9,477
  • 4
  • 61
  • 77
zeroin
  • 5,863
  • 6
  • 31
  • 42
  • 1
    Thanks for the good answer, it helps, but I notice the chart is still listed in global AmCharts.charts array. I've asked AmCharts support, don't really want to remove it by hand… – NPC Feb 17 '16 at 20:32
0

Also you can destroy(delete) the chart using these two simple methods

  • chart is not a key word you can change whatever you want to name your chart for example my chart name is ActionPieChart ActionPieChart.destroy();

chart.destroy();

or

chart= null;
Amir Danish
  • 418
  • 5
  • 8
-1

If by delete you mean delete from the page or to hide it, you could also use:

document.getElementById('[[ChartDIV]]').style.display = 'none';
Simon
  • 698
  • 7
  • 13