sbaskar1
Posts: 4
Joined: Wed Aug 17, 2022 1:06 pm

Determine the starting min value of y axis that highchart assigns

We are using licensed Highcharts.

We are trying to create a chart with few icons(or lets say series) that fall on x axis line ( which means the points for icons will be (x1, 0) or (x2,0) x1 and x2 being points on x axis line and we have hardcoded the y axis value to 0. Problem occurs when we set min value for y axis and highcharts automatically assigns a min for y axis starting point. EG: when we say minimum for y axis is 86 highcharts sometimes starts from 80 as y axis min which is an inherent behavior. But now we want to change the y value for the icons to 80 because only then will it sit on the x axis line. But the problem is that we cannot get the min value of the y axis which highcharts inherently assigns. Is there a way to get this value?

PS: we don't want to use tickinterval, tickamount and want the ticker intervals to be dynamic according to the series values.

eg:
Highcharts.chart('container', {
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},

yAxis: {
min: 55,
startOnTick: true
},

series: [{
data: [80, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 160.4, 194.1, 95.6, 65]
}]
});

for this above code in js fiddle though the min is set to 55 the y axis starts from 50 and we want this value (50) so that we can use it to construct a series. Please let us know how we can achieve this. Thanks
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Determine the starting min value of y axis that highchart assigns

Hi there,

Welcome to our forum and thank you for contacting us with your question!

There are a few ways that you can use to achieve it.

You can create a scatter series with only x values as points, and then the y value will be updated on chart initial load.
DEMO: https://jsfiddle.net/BlackLabel/nxp71d4c/

You can use the Highcharts.SVGRenderer:
https://support.highcharts.com/support/ ... -renderer-

Or you can use Highstock Flag series:
https://www.highcharts.com/docs/stock/flag-series

Feel free to contact us anytime,
Regards!
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Usage”