I am using the Chart.js library to draw a bar graph, it is working fine, but now I want to destroy the bar graph and make
Create a global object:
window['chart-' + chartId] = new Chart(...);
Access and destroy to procced with redraw:
if ( window['chart-' + chartId] != undefined ) { window['chart-' + chartId].destroy(); }