qwertyswoop
Posts: 3
Joined: Mon Feb 19, 2024 2:25 pm

tickPixelInterval not working

Hello!

Is there anything can can cause tickPixelInterval to not work? I have tickPixelInterval set to 100 (which should be default), but even so, I sometimes see labels closer to each other than 100 px?
jedrzej.r
Posts: 742
Joined: Tue Jan 24, 2023 11:21 am

Re: tickPixelInterval not working

Hi!

Welcome to our forum and thanks for reaching out to us with your inquiry!

Could you please provide a minimal reproducible demo, where this issue can be observed? You can start by editing below demo. Also, please note that sometimes the tickPixelInterval might not work due to the axis being set as ordinal.

Demo: https://jsfiddle.net/BlackLabel/bLnvhdyf/

Patiently waiting for your reply.
Best regards!
Jędrzej Ruta
Highcharts Developer
qwertyswoop
Posts: 3
Joined: Mon Feb 19, 2024 2:25 pm

Re: tickPixelInterval not working

Hi,

So in the demo you provided, the tickPixelInterval can sometimes become less than 100 when changing the screen size. Try making the screen smaller and the space between each tick becomes something like 72 px. :)
jedrzej.r
Posts: 742
Joined: Tue Jan 24, 2023 11:21 am

Re: tickPixelInterval not working

Indeed, you are correct, this is because the tickPixelInterval property tries to set the distance between tick marks approximately, as stated in the API:
this option sets the approximate pixel interval of the tick marks
This behaviour stems from the fact that there are many factors impacting the axis ticks layout, so it's not entirely possible to make them mantain e.g. a 100px distance on every resolution.

​If you have further inquiries, you may reach out to me at any time.
Best regards!
Jędrzej Ruta
Highcharts Developer
qwertyswoop
Posts: 3
Joined: Mon Feb 19, 2024 2:25 pm

Re: tickPixelInterval not working

Ahh I see... Is there any way to make it impossible for the tick interval to be smaller than x pixels? My issue is that sometimes my labels become too cluttered, where only like 4-5 pixels separate them.
jedrzej.r
Posts: 742
Joined: Tue Jan 24, 2023 11:21 am

Re: tickPixelInterval not working

Hi again!

It is hard to tell what could be a reason behind such output without seeing a demo. Perhaps you could provide a minimal reproducible demo by editing this fiddle: https://jsfiddle.net/BlackLabel/6xazc5gq/.

Also, you can try setting the minTickInterval, which might be two small when the data is too clustered: https://api.highcharts.com/highcharts/x ... ckInterval.

Patiently waiting for your reply.
Best regards!
Jędrzej Ruta
Highcharts Developer

Return to “Highcharts Stock”