Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
get current index of point in tooltip
Hi,
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.
Thanks.
Hi,
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,
Olli
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.
Hi,
I think the this.series.data array is what you want. You should be able to find this.point 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.
-Olli