i have an angular 8 application, and i'm using primeng-lts 8.2.5 components, i'm trying to use chart.js version 2.9.3 in my application, but the pie chart doesn't show up until i zoom in, also the labels.
in my pie chart i'm displaying counts by status, as in the code below, i'm loading status[] from an http call, then for each status, i'm calling an http method that return the counts :
HTML :
<p-chart type="pie" [data]="numberByStatus" >
</p-chart>
TS :
numberByStatus : any;
labelsByStatus: String[] = [];
countsByStatus: number[] = [];
this.service.getStatus()
.subscribe((res: status[]) => {
res.forEach(element => {
this.service.getCountByStatus(element.id)
.subscribe((count: number) => {
this.countsByStatus.push(count);
this.labelsByStatus.push(element.designation)
}, (err) => {
alert('Faild to load counts');
});
});
}, (err) => {
alert('Faild to load data');
});
this.numberByStatus = {
labels: this.labelsByStatus,
datasets: [
{
data: this.countsByStatus,
backgroundColor: [
"#FF6384",
"#36A2EB",
"#FFCE56"
],
hoverBackgroundColor: [
"#FF6384",
"#36A2EB",
"#FFCE56"
]
}]
};