0👍
✅
You push to the labels and data array, if you dont want to show previous data you need to remove this data first or just entirly override the array:
success: function(data) {
myChartpendapatan.data.labels = [];
myChartpendapatan.data.datasets[0].data = [];
$.each(data.result, function(id, value) {
myChartpendapatan.data.labels.push(value.nama_bidang);
myChartpendapatan.data.datasets[0].data.push(value.total_anggaran);
});
myChartpendapatan.update();
},
Source:stackexchange.com