20 lines
650 B
JavaScript
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']);
|
|
}
|
|
|
|
} |