2👍
✅
You are binding data to the wrong property of canvas element/object. When you have array of multiple datasets, you must bind it to the datasets
property, instead of data
.
Also, you should bind the datasets
property of your class (not data_in
) to [datasets]
(here setTimeout
is not doing what you think it is)
...
<canvas baseChart width="400" height="200"
[datasets]="datasets"
[labels]="labels"
[options]="lineChartOptions"
[colors]="lineChartColors"
[legend]="lineChartLegend"
[chartType]="lineChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)">
</canvas>
...
see- working example
(uses minimal code required)
Source:stackexchange.com