Ning Kang
Posts: 1
Joined: Mon Jun 20, 2022 3:45 pm

How to align gridLine and axis line ?

When we set gridLineWidth, it seems like the first and the last gridLine grow beyond/beneath the axis line.
Is there a way to align gridLine and axis line ?


(Please see the red box area)

img
actual behavior: Image
expected behavior: Image

jsfiddle
actual behavior: https://jsfiddle.net/curarning/xs3fgj12/16/
expected behavior: https://jsfiddle.net/curarning/d9z6o5gh/7/
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: How to align gridLine and axis line ?

Hello Ning Kang!
Welcome to our forum and thanks for contacting us with your question!

There is no option in API, which can achieve the look you are requested, but you can add some custom code to render event and calculate how much the yAxis line should be stretched. Please, check the demo below.

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

Let me know if that fits your requirements.
Kind regards!
Hubert Kozik
Highcharts Developer

Return to “Highcharts Usage”