Skip to content Skip to sidebar Skip to footer

Set Highchart Yaxis's Min Max To A Specific Series Only

I have a stock price candlestick series And a line series that share yAxis with the candlestick series. By default, the API automatically set chart's yAxis range to the min/max of

Solution 1:

In 'afterDrawChartBox' event, you can use setExtremes method with min and max values from candlestick series:

Highcharts.addEvent(Highcharts.Chart, 'afterDrawChartBox', function(e) {
    var candlestick = this.series[0];
    this.yAxis[0].setExtremes(candlestick.dataMin, candlestick.dataMax, true, false);
});

Live demo: https://jsfiddle.net/BlackLabel/520km1wv/

API Reference: https://api.highcharts.com/class-reference/Highcharts.Axis#setExtremes

Post a Comment for "Set Highchart Yaxis's Min Max To A Specific Series Only"