Chartjs-Chartjs: old data being displayed

0๐Ÿ‘

โœ…

I would need to run your example to be sure but maybe the following would help.

Instead of destroying the chart you can add and remove datasets,

  • Remove dataset before adding new data

    data.labels = []; //Empty label array
    data.datasets.splice(0, 1);//Removes first dataset
    
  • Add new dataset and labels

  • Update chart

    pauzeAmountChart.update();
    

I have a working example which retrieves new data from a webapi and updates every 10 seconds, if this isnt sufficient

Leave a comment