I am trying to show the total of the Y axis as a subtitle for a HighStock chart. This is initially accomplished by summing up the point.y value of all the series, inside the "load" event like so:
chart: {
events: {
load: function () {
var chart = this,
series = chart.series,
seriesSum = 0;
series.forEach(function (series) {
series.data.forEach(function (point) {
seriesSum += point.y
})
})
this.update({
subtitle: { text: 'TOTAL: ' + seriesSum }
});
},
}
}
Now I need to update the TOTAL amount after the chart has been redrawn after changing the timeframe using either the Navigator or the Range Selector. I know there is a "redraw" event, but that will end me up in an infinite loop. Which event should I be tack onto?