Updating chart.js in Angular
up vote
0
down vote
favorite
I want to create a chart by add labels and data from an API and update this one. I create a method addData() in charts.component.ts that looks in this way: addData(chart, labels_builds,labels_data){ chart.data.labels.push(labels_builds); chart.data.datasets.data.forEach(dataset => { dataset.data.push(labels_data); }); chart.update(); } This will be call here: getMisraLintChart(projectVariantId: number,filterType : string, filterValue: string): void { this.chartService.getMisraLintChart(projectVariantId, filterType, filterValue) .subscribe(pageChart =>{ this.chartMisraLint = pageChart this.addData(this.myChart,pageChart.build,pageChart.data); }) } In ngOnInit() i have this code: ngOnInit() { this.getFilte...