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