0👍
Your ngIf waits for lines to be not null, but ‘lines’ already has a value when you fill your dataset. Your chart is being created before your dataset is ready.
Try
<div class="ibox-body" *ngIf="lineChartData">
<div style="display: block;">
<canvas baseChart height="120"
[datasets]="lineChartData"
[labels]="lineChartLabels"
[options]="lineChartOptions"
[colors]="lineChartColors"
[legend]="lineChartLegend"
[chartType]="lineChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>
If this doesn’t work, can you post your services’ function you use to get data?
- Chartjs-Chart.js hide x/y axis, customize
- Chartjs-Can't get data into my Javascript function using Django
Source:stackexchange.com