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.
Asked
Active
Viewed 1.9k times
16
-
Try to nullify the dataProvider. – Anurag Feb 05 '15 at 06:59
3 Answers
26
If you want to destroy the chart object, at all, call:
chart.clear();
and then null the chart variable:
chart = null;
-
1Thanks 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
-
Does `chart.destroy() ` also call `series[i].destroy()` for all series in the chart? – CodeMonkey Oct 25 '19 at 13:26
-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