Chartjs-How to reuse a Chart.js chart in Blazor wasm?

0👍

Got it:

window.setup = (id, config) => {

    var myChart = Chart.getChart(id);

    if (myChart != undefined) {
        myChart.destroy();
    }

    var ctx = document.getElementById(id).getContext('2d');
    new Chart(ctx, config);

    console.log(config);
}

(First it was not working for reasons of the browsers cache)

Leave a comment