score:1

Accepted answer

Inside setExtremes, this references the xAxis object. The threshold is on the series object, so you need to get a reference to the right series.

var series = this.chart.series[0];

Then, you need to update it with the new value.

series.update({threshold: threshold}, false);

I'm passing false for the redraw parameter, since we're also going to update the plotLine, and we'll only want to redraw once.

For the plotLine, you'll need a reference to the yAxis.

var yAxis = this.chart.yAxis[0];

And, then you'll need to pass the new plotLine settings to the update method.

 yAxis.update({
     plotLines: [{
        value: threshold,
        color: 'green',
        dashStyle: 'shortdash',
        width: 2,
        label: {
             text: 'Last quarter minimum'
        }
     }]
 });

https://jsfiddle.net/w6bzohgd/3/


Related Query

More Query from same tag