Chartjs-Chart JS Replace All Dataset Data

1👍

This is because you are doing it wrong, the datasets field is an array containing all datasets so it doesn’t contain a data field. You need to target the specific dataset from which you want to replace the data like so:

myChart.data.datasets[datasetIndex].data = @this.data; // in case you only have 1 dataset you can just hardcode a 0
myChart.update();

Leave a comment