ElementStacks
by tellnes
HTML
<script src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js"></script>
<script src="http://static-origin.ig-dev.tsysapis.com/1312636477/ms/green/highcharts.js"></script>
<div id="container"></div>
<button id="button">Destroy the chart</button>
JavaScript
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
height: 300
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
setTimeout(function() {
var cont = {cont: cont = $('container')};
cont.cont.parentNode.removeChild( cont.cont )
delete cont.cont;
console.log( cont, cont.cont )
// chart.destroy();
}, 500);
// the button handler
$('button').observe('click', function() {
chart.destroy();
});