[Chartjs]-How to add data from database to chartjs-plugin-streaming

1👍

According to the Chart.js documentation you can update your graph with something like this:

async function updateGraphWithData() {
    const data = await apiCall(); // Your call to your backend

    lineChart.data.datasets.forEach(dataset => {
        dataset.data = data;
    });

    lineChart.update();
}

You need something which will trigger the function (like a button click) or something else.

Leave a comment