dizzy
Posts: 79
Joined: Mon Aug 01, 2022 5:28 pm

Mutliple pane y-axis labels not aligned

I have a chart that has 2 panes: https://jsfiddle.net/dizzy0ny/vpfy48u3/12/

you will notice that the right y-axis labels are not aligned with each other. the 2nd one has some padding it seems. I know i can go ahead and adjust for that by using yAxis.labels.x. But i want to understand why this is happening because i am actually generating these charts through code. That means there can be N number of panes/series created at run time and so i need to figure out either how to get them to align nicely with a single setting, or i need to figure out an offset by which each pane's yaxis x position needs to be adjusted.

You can see the same issue with 3 panes here as welll in the below attached screenshot. notice how each of the pane's y-axis has an offset from the left
Screenshot 2022-08-02 190833.png
Screenshot 2022-08-02 190833.png (108.77 KiB) Viewed 535 times
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Mutliple pane y-axis labels not aligned

Hi there,

It is a Highcharts default behaviour that sets a default yAxis.offset to make them more readable.

Simply set the yAxis.offset to 0 on every yAxis and you are good to go.

DEMO: https://jsfiddle.net/BlackLabel/km8ohwa0/
API Reference: https://api.highcharts.com/highcharts/yAxis.offset

Best regards!
Kamil Musiałowski
Highcharts Developer
dizzy
Posts: 79
Joined: Mon Aug 01, 2022 5:28 pm

Re: Mutliple pane y-axis labels not aligned

thank you!
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Mutliple pane y-axis labels not aligned

You're welcome! Have a great day :)
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Usage”