如何获得Highcharts工具提示中的下一个点 [英] How to get next point in Highcharts tooltip

查看:149
本文介绍了如何获得Highcharts工具提示中的下一个点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从工具提示格式化程序访问系列的下一个点。
因为我想在两点之间做一笔总和。
喜欢this.y + next.y。



但我不知道如何获得下一个点。



如果有人有答案。谢谢

解决方案

这需要通过几个步骤来完成:


  • 根据x值得到x-index: var index = this.series.xData.indexOf(this.x);

  • 现在获得y值: var nextY = this.series.yData [index + 1];



所有你需要做的就是求和值,如下所示: var sum = this.y + nextY;


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

解决方案

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

这篇关于如何获得Highcharts工具提示中的下一个点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆