I have a chart.js chart using ng2-charts module. The chart shows Percentage on y axis and time on x axis. Is it possible to set y axis to show 0 to 100 instead of dynamic range based on data?
Try adding the following to your chart options:
scales : {
yAxes: [{
ticks: {
steps : 10,
stepValue : 10,
max : 100,
min: 0
}
}]
}
https://github.com/valor-software/ng2-charts/issues/853
In my name.component.html:
<div style="display: block">
<canvas baseChart height="100" [datasets]="lineChartData" [labels]="lineChartLabels" [options]="lineChartOptions"
[colors]="lineChartColors" [legend]="lineChartLegend" [chartType]="lineChartType"></canvas>
In my name.component.ts:
public lineChartOptions: any = {
scales : {
yAxes: [{
ticks: {
beginAtZero: true,
stepValue: 10,
steps: 20,
max : 50,
}
}]
}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With