Chartjs-How can I reload data from chartjs after JSON file was modified in a HTTP POST

0👍

You can create a function that will accept data. Just pass the data that you get from POST request and chart.update() will do the magic. Make sure to pass the chart reference in chart variable.

    function addData(chart, label, data) {
        chart.data.labels.push(label);
        chart.data.datasets.forEach((dataset) => {
            dataset.data.push(data);
        });
        chart.update();
    }

Leave a comment