0👍
I did some research on internet and read the documentation. I couldn’t find the definite answer for my problem. Following process worked for me:
- I downgraded chart.js from 2.4.0 to 2.3.0
- I added the boolean to my component to indicate data was received from RESTApi or not. I used that flag to display canvas using *ngIf.
HTML markup looks as follows:
<canvas
baseChart
class="chart"
[data]="data.pieChartData"
[labels]="data.pieChartLabels"
[chartType]="data.pieChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"
*ngIf="isDataAvailable"
>
</canvas>
Source:stackexchange.com