Samaf
Posts: 7
Joined: Tue Jun 27, 2017 4:15 pm

Min/Max control when using twin Y Axis

I have created a chart that has 2 Y Axis using the Custom Code below. I'm trying to understand how the min/max properties work. The chart respects the 8,-4 max/min properties but not the 102,90 max/min properties. Is there some way to manage both? I may be missing something obvious - protective apologies if this is the case.

Here is the chart link: http://cloud.highcharts.com/show/ynicaho






Highcharts.extend(options, Highcharts.merge(options, {
yAxis: [{
opposite:false,
title: {
text: 'big numbers'
},
max:102,
min:90,
}, {
opposite: true,
title: {
text: 'little numbers'
},
max:8,
min:-4,

}] // setting two axis
}));

options.series[0].yAxis = 1; // link first series to second axis
pawel_d
Posts: 1910
Joined: Thu Jun 02, 2016 10:28 am

Re: Min/Max control when using twin Y Axis

Hi Samaf,

Do you mean that the chart does not respect -4 and 8? Because from what I can see, 90 and 102 display fine. To correct this you can set lower tickInterval, for example 2. You could also use setExtremes() function. Take a look at the corrected example.

API Reference:
http://api.highcharts.com/highcharts/yAxis.tickInterval
http://api.highcharts.com/highcharts/Axis.setExtremes

Example:
http://jsfiddle.net/dj6jpdrq/

Regards.
Paweł Dalek
Highcharts Developer
Samaf
Posts: 7
Joined: Tue Jun 27, 2017 4:15 pm

Re: Min/Max control when using twin Y Axis

Pawel,

Many thanks for the quick response. Appreciated. I'll take a look and revert.
Samaf
Posts: 7
Joined: Tue Jun 27, 2017 4:15 pm

Re: Min/Max control when using twin Y Axis

Pawel,

I had a look at the fiddle example. Please excuse me I'm newbie but I'm still a little confused. For instance, setting the "big numbers" min/max axis to 92/104 redraws the chart with an axis of 90/114. Is this expected behaviour? Is there any chance you could add an example of how to use the setExtremes? That way I can be sure of being able to set "hard" min/max values for each axis. Again I appreciate your help with this as I'm just getting started. regards Sam
Samaf
Posts: 7
Joined: Tue Jun 27, 2017 4:15 pm

Re: Min/Max control when using twin Y Axis

Pawel,

Not sure if this is my mistake/confusion but the link below seems different in edit and view mode. In edit mode the left axis is 88/112 and in view/shared mode it is 90/102. Is this to do with my "context" maybe? http://cloud.highcharts.com/show/azapyzy
Samaf
Posts: 7
Joined: Tue Jun 27, 2017 4:15 pm

Re: Min/Max control when using twin Y Axis

Apologies. I'm being stupid. Please ignore my second comment. Its merely screen resizing. Doh.
pawel_d
Posts: 1910
Joined: Thu Jun 02, 2016 10:28 am

Re: Min/Max control when using twin Y Axis

Hi Samaf,

No problem. In case of any other question, feel free to ask.

Regards.
Paweł Dalek
Highcharts Developer

Return to “Highcharts Cloud”