I am wanting to prevent the display of decimal values on a y-axis of an area chart I have configured.
When my chart initially shows with all series showing, I see:
But after filtering out some of the series to show, I see the y axis start showing decimal values like so:
My yAxis config is as follows:
yAxis: {
gridLineColor: 'transparent',
allowDecimals: false,
type: 'logarithmic',
minorTickInterval: 1,
lineWidth: 0,
gridLineWidth: 0,
minorGridLineWidth: 0
},
I wondered if this had something to do with being a logarithmic scale, but when I comment out the type
option to revert to using a default scale, it makes no difference, I observe the same behaviour.
Is there a way to prevent decimals showing and only have whole values showing?
Thanks
Update:
So I have replicated in a fiddle here -> https://jsfiddle.net/parky12/cn5mdzea/
Seems this is related to being on a logarithmic scale.
If you disable the low series, then decimals appear on the axis.
Is there a way to prevent these showing?
I found this configuration worked for me:
yAxis: {
gridLineColor: 'transparent',
allowDecimals: false,
type: 'logarithmic',
tickInterval: 0.1,
startOnTick: false,
lineWidth: 0,
gridLineWidth: 0,
minorGridLineWidth: 0
},
bear in mind that the tickInterval property works differently for logarithmic axes, i.e. 1 would be a label at every power of 10, so for this data set at least you want an interval of 0.1
Fiddle
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