How to get next point in Highcharts tooltip

前端 未结 1 1955
情话喂你
情话喂你 2021-01-14 16:32

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

1条回答
  •  梦毁少年i
    2021-01-14 17:07

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

    0 讨论(0)
提交回复
热议问题