0👍
✅
Try to use min
and max
instead of suggestedMin
and suggestedMax
as follows:
xAxes: [{
ticks: {
min: -15,
max: 40
}
}]
From Chart.js documentation
The
suggestedMax
andsuggestedMin
settings only change the data values that are used to scale the axis. These are useful for extending the range of the axis while maintaining the auto fit behaviour.
min
: User defined minimum value for the scale, overrides minimum value from data.
max
: User defined maximum value for the scale, overrides maximum value from data.
UPDATE
The problem is probably that the labels are strings but min
and max
are defined as numbers. This can be solved in two different ways.
Either you transform the labels into numbers or you define min
and max
as follows:
xAxes: [{
ticks: {
min: '-15',
max: '40'
}
}]
Source:stackexchange.com