///Setup del chart desiderato con id univoco window.setup = (id, config) => { var ctx = document.getElementById(id).getContext('2d'); if (window['myChart'] instanceof Chart) { window['myChart'].destroy(); window['myChart'] = new Chart(ctx, config); } else { window['myChart'] = new Chart(ctx, config); } }