score:1

Accepted answer

You can compare the plot line value to the actual axis extremes and change min and max properties if necessary. For example:

yAxis.update({
  min: yAxis.min > limits.min ? limits.min : null,
  max: yAxis.max < limits.max ? limits.max : null,
  plotLines: [{
    value: limits.max,
    width: 2,
    color: 'orange'
  }, {
    value: limits.min,
    width: 2,
    color: 'blue'
  }]
});

Live demo: http://jsfiddle.net/BlackLabel/6m4e8x0y/4989/


Related Query

More Query from same tag