I am using the points from my base series[0] to calculate an average value that is displayed as a plotline on the y axis - see https://jsfiddle.net/3guh7d8m/5/.
The issue with this code is that when you hide the series, either by using a button linked to chart.series[0].hide() or by clicking on the legend item to hide the series, the plotline will disappear and the following error is thrown in the console: Uncaught TypeError: Cannot read property 'length' of null"
I understand that this occurs because after hiding the series, the points on the axis (referred to in the calculation of average) no longer exist.
You will see in my fiddle that I have set the navigator series to the same data as my base series so I wondered if there was any way of getting the points for the average calculation from the navigator rather than from the main plot as the navigator data remains visible at all times?
Any help would be much appreciated.