17 lines
588 B
JavaScript
17 lines
588 B
JavaScript
// Setup del chart desiderato con id univoco
|
|
window.setup = (id, config) => {
|
|
var ctx = document.getElementById(id).getContext('2d');
|
|
//let currentDate = new Date();
|
|
//console.log(currentDate + " - Calling setup...");
|
|
//console.log(id);
|
|
if (window['chart-' + id] instanceof Chart) {
|
|
//window.myChart.destroy();
|
|
window['chart-' + id].destroy();
|
|
//console.log("Chart " + id + " destroyed!");
|
|
}
|
|
|
|
window['chart-' + id] = new Chart(ctx, config);
|
|
//console.log("Chart " + id + " created!");
|
|
//console.log(window['chart-' + id]);
|
|
}
|