Currently, I am using the ng2 chart in my application, but I am unable to bind chart data dynamically.
My code is :
- public barChartOptions:any = {
- scaleShowVerticalLines: false,
- responsive: true
- };
- public barChartLabels:string[] = ['Feb', 'Mar', 'Apr'];
- public barChartType:string = 'bar';
- public barChartLegend:boolean = true;
- public barChartData = [
- {data: [5,7,9], label: 'Activity'},
- ];
-
Want to change "data" property inside the barChartData, like this :
- const data0 = [ 8,8,9 ];
- this.barChartData[0].data=data0;
Above lines i wrote inside ngOnInit().
I also go through these links :
https://stackoverflow.com/questions/39078061/dynamically-updated-ng2-charts
https://alligator.io/angular/chartjs-ng2-charts/
https://github.com/valor-software/ng2-charts/issues/859
But didn't get any solution, could you please help me out.