0๐
I also encountered this problem when trying to apply translations to the labels I used in the graph. I have read somewhere also here in stackoverlfow that you have to change the reference of the array you are using in the graph.
For your example, you can try
getLabel(depositParent) {
let target = this.depositSourceValue[depositParent];
this.doughnutChartLabels = [...this.doughnutChartLabels, depositParent];
// this.chart.chart.update();
}
getData(depositParent) {
let data = this.depositSourceAmount[depositParent];
this.doughnutChartData = [...this.doughnutChartData, depositParent];
// this.chart.chart.update();
}
I would also suggest that you use a service that holds an Observable and let this component subscribe to it so that it receives the notification and call the code that updates the graph.
Hope this helps.
- Chartjs-Angular ChartJs does not show Data for multiple Charts
- Chartjs-Chart.js minimal width of Chart with scrollable overflow
Source:stackexchange.com