ivankozlov
Posts: 2
Joined: Wed Apr 06, 2022 7:11 am

Prevent rounding up axis tick position values

Hello! I need to draw some charts with strongly fixed Y axis range. And one more important condition - Y axis should starts and ends with range limits.

My problem can be reproduced here: https://jsfiddle.net/VannyKo/6cvhpkrq/35/ .

I've read that when I set

Code: Select all

startOnTick = {true}
or

Code: Select all

endOnTick = {true}
for Y-axis it limits "might be rounded up". Are any ways to prevent this rounding completely?

My only idea is to use tickPositioner , but this is not good solution because values higher then range limit but less then rounded up value still be displayed
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Prevent rounding up axis tick position values

Hi ivankozlov,

Thanks for contacting us with your question.

You're right, startOnTick and endOnTick properties should be used in this case. By default axis' ticks and values are calculated automatically, making sure that the scale is easily readable and values are rounded. Because of that sometimes calculated interval doesn't match min and max and thus those values are slightly rounded.
Demo:https://jsfiddle.net/BlackLabel/0cutfbor/

Let me know if it was what you were looking for.
Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”