get current index of point in tooltip


I am useing the chart for time and dixtance graph.
y contains distance and x shows the value for time.

In tooltip I have to show the speed and to calculate this I want y axis value of previous point ( current distance = currentY- previosY). If I have the index of current point on mouse over then i can get the value of prevois point using this.points array.



if I looked at it correctly, this.points contains the values of each series at current x position, not all the values of the current series. So if you have only one series, there will always only be one item in the points array. Maybe you could calculate the speed in a different series and make that not visible; then you could display the value in the tooltip with points[1]
(or whichever is the index of the speed series).

Hope this helps,

Thanks Olli,

Yup I have only one series in my chart. Actually I need value for previous x position. how could I get it ?

Thanks once again Olli.


I think the
array is what you want. You should be able to find
in that array and get the previous value by going one step back from that. You’ll of course need to write some special handling for the first case.