Chart JS Charts
Code
<app-chart-component *ngIf="dashboardData?.salesChart" [type]="dashboardData?.salesChart?.type"
[id]="'total-sales-chart'" [data]="dashboardData?.salesChart?.data"
[options]="dashboardData?.salesChart?.options"
[customData]="dashboardData?.statistics?.custom_data || null"></app-chart-component>
Required Chart Data
[id] input takes id of chart. It should be unique for every chart.
[data] input takes data to generate chart.
[options] input takes charts inputs.
[custom_data] is used to update chart data like if you showing data for month and you want it to change for year. Otherwise it would be null
{
"type": "doughnut",
"data": {
"labels": [
],
"datasets": [
{
"label": "Doughnut chart",
"data": [
],
"backgroundColor": [
],
"borderWidth": 0
}
]
},
"options": {
"responsive": true,
"maintainAspectRatio": false,
"legend": {
"position": "top",
"display": false
},
"cutoutPercentage": 70
}
}



