0π
β
Iβm not sure why the stack isnβt updating or why changing the type helps in your example.
The way I do this is to completely remove the dataset and then add a new dataset as Iβve never had a need to just change the stack, usually all of the dataset gets updated:-
Removing a dataset:-
function removeDataset(chart, label) {
chart.data.datasets = chart.data.datasets.filter(function(obj) {
return (obj.label != label);
});
chart.update();
}
Adding a dataset:-
function addDataset(chart, dataset) {
chart.data.datasets.push(dataset);
chart.update();
}
I have added a fork to your fiddle to demonstrate this working https://jsfiddle.net/u21vw9sh/
Source:stackexchange.com