javascript - Highcharts: Getting average values for selection in line graph - Stack Overflow

admin2025-04-21  1

In a line mon chart: /

How can I get the average value of xAxis on selected elements?

In the above example, I can only access to the min and max values of the graph but not the inbetweeen values nor the minimum point selected value.

So, if I have 1,2,3,4,5 and I select points from 2 to 4 I want to have an array with [2,3,4] with an average value of (2+3+4)/3.

Is there any way to get, at least, the index array of min and max xAxis values?

Thanks in advance.

In a line mon chart: http://jsfiddle/yuKwp/

How can I get the average value of xAxis on selected elements?

In the above example, I can only access to the min and max values of the graph but not the inbetweeen values nor the minimum point selected value.

So, if I have 1,2,3,4,5 and I select points from 2 to 4 I want to have an array with [2,3,4] with an average value of (2+3+4)/3.

Is there any way to get, at least, the index array of min and max xAxis values?

Thanks in advance.

Share Improve this question asked Sep 19, 2012 at 14:14 MaCMaC 5387 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

If you need to count average value of points that will be in plot after xAxis extremes will be set, check out this fiddle: http://jsfiddle/yuKwp/3/ (i.e. you select points from 2 to 4, but after setting extremes, in plot will be points from 1 to 5)

But if you want to only count point that selected by yourself, check this fiddle: http://jsfiddle/yuKwp/4/

Hope this helps, but if not, don't be afraid to ask me.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745215731a290838.html

最新回复(0)