Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get next point in Highcharts tooltip

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.

like image 748
Splinteer Avatar asked Jan 01 '26 20:01

Splinteer


1 Answers

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;.

like image 79
Paweł Fus Avatar answered Jan 06 '26 12:01

Paweł Fus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!