borglin
Posts: 2
Joined: Wed Feb 15, 2023 8:20 am

Control spacing between yAxis and first candle

I have two line charts and one candlestick chart and I'm trying to get the ticklines to line up between them but I haven't found a way to adjust the spacing between the y-axis and the first data point (first minor tick). This leads to all subsequent ticks being slightly misaligned. Is there an option available that would allow me to keep the y-axis aligned and all the gridlines?
Attachments
Screenshot 2023-02-15 at 09.20.00.png
Screenshot 2023-02-15 at 09.20.00.png (72.53 KiB) Viewed 441 times
jakub.s
Posts: 1164
Joined: Fri Dec 16, 2022 11:45 am

Re: Control spacing between yAxis and first candle

Hi,

Welcome to our forum & thanks for the question!

Could you please send me a demo?

I'll take a look & try to change it.

Regards,
Jakub
Jakub
Highcharts Developer
borglin
Posts: 2
Joined: Wed Feb 15, 2023 8:20 am

Re: Control spacing between yAxis and first candle

Hi!

Thanks for looking.

This is minimal example showing the same problem: https://jsfiddle.net/borglinm/mq0oxtz7/9/

Ideally the vertical gridlines should line up, regardless of the number of data points, chart width or chart type.
Attachments
Screenshot 2023-02-16 at 14.51.47.png
Screenshot 2023-02-16 at 14.51.47.png (158.47 KiB) Viewed 426 times
jakub.s
Posts: 1164
Joined: Fri Dec 16, 2022 11:45 am

Re: Control spacing between yAxis and first candle

Hi,

Thanks for the demo.

I think the easiest way to achieve it is to put it into one chart with 2 yAxis and using the chart.alignTicks option. Here's the demo: https://jsfiddle.net/BlackLabel/c9znxg5b/

API: https://api.highcharts.com/highcharts/chart.alignTicks

Let me know if any more questions arise.

Best regards,
Jakub
Jakub
Highcharts Developer

Return to “Highcharts Stock”