I am currently using ng2-charts and have an array of data. The challenge I am facing is that when I only have data for Tuesday and Wednesday, the chart only displays those two days. However, I would like the x-axis to remain static, showing all days of the week (Sun-Sat). Here is an example of what I have:
Current Chart Display:
https://i.sstatic.net/oAeA5.png
Desired Chart Display:
https://i.sstatic.net/KRxm3.png
HTML
<div style="display: block" *ngIf="barChartData">
<canvas baseChart width="400" height="180" style="margin-left:5%;margin-
top: 5%;" [datasets]="barChartData"
[labels]="barChartLabels" [options]="barChartOptions"
[legend]="barChartLegend" [chartType]="barChartType"
(chartHover)="chartHovered($event)" [colors]="chartColors"
(chartClick)="chartClicked($event)"></canvas>
</div>
TS
this.barChartLabels = this.days; //Expecting all week days [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
setTimeout(() => {
this.barChartData = [
{ data: this.marks },
]
})