0👍
✅
In your fiddle there are a couple of things that need to be corrected:
First – you’re declaring a new set of data in your if statement and then not assigning it to the chart.
Second – you’re not updating the chart.
Try this code:
let revisedViewsdata = "4,3,2,1,0,1,2";
myChart.data.datasets[0].data = revisedViewsdata;
myChart.update();
Source:stackexchange.com