Fabrice
Posts: 20
Joined: Mon May 15, 2017 1:55 am

Label not showing on the xAxis when there are too many items

I have a question regarding the labels on the xAxis when there isn't enough space

Check the example below:

https://economy.id.com.au/economic-indicators

Albury is not showing on the xAxis because there is not enough space to display all the items

My question is: How can I prioritise a certain item as to be sure it is displayed on the xAxis?

Thanks!
jakub.j
Posts: 1091
Joined: Tue Jan 24, 2023 11:14 am

Re: Label not showing on the xAxis when there are too many items

Thanks for contacting us!

Unfortunately, there is no functionality like that built in Highcharts.

I prepared a solution for you, where in initalVisibleLabels array you can set which labels will be shown at chart render, than on xAxis.events.setExtremes, if the chart is zoomed in, all the labels are shown (because than, they should fit).
On reset button click, the labels go back to the initial state from chart render.

Demo: https://jsfiddle.net/BlackLabel/7worme9a/

Feel free to ask any further questions!
Best regards
Jakub

Return to “Highcharts Usage”