How to get next point in Highcharts tooltip

2019-02-18 23:48发布

how can I access to the next point of the series from the tooltip formatter. Because I want to do a sum between both points. Like this.y + next.y.

But I don't know how to have an access to the next point.

If someone have an answer. Thanks

1条回答
Juvenile、少年°
2楼-- · 2019-02-19 00:05

This need to be done in a few steps:

  • get x-index according to x-value: var index = this.series.xData.indexOf(this.x);
  • now get y-value: var nextY = this.series.yData[index+1];

And all you need to do is to sum values, like this: var sum = this.y + nextY;.

查看更多
登录 后发表回答