Files
mapo-core/MP.SPEC/wwwroot/lib/chartBoot.js
T
2022-10-14 12:39:43 +02:00

20 lines
650 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['myChart'] instanceof Chart) {
//window.myChart.destroy();
window['myChart'].destroy();
console.log("Chart " + id + " destroyed!");
window['myChart'] = new Chart(ctx, config);
}
else
{
window['myChart'] = new Chart(ctx, config);
//console.log("Chart " + id + " created!");
console.log(window['myChart']);
}
}