How to get next point in Highcharts tooltip

你说的曾经没有我的故事 提交于 2019-12-01 06:16:28

问题


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:


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



来源:https://stackoverflow.com/questions/21578555/how-to-get-next-point-in-highcharts-tooltip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!