Getting other data than x, y pointNumber

Hi guys,

recently I was able to add some additional click js event to the plot.

However, I have a problem that I cannot solve. According to the plotly documentation on how to handle events some variables are easy returned, like curveNumber, pointNumber, x, y and data:

something like:

var plotly_data =
    for(var i=0; i < data.points.length; i++){

I have a plot where I have defined and ids list of unique ID. Getting the x or y (or pointNumber) of the clicked plot is pretty straightforward, is it possible to get also the linked element of the ids (that is not equal to the pointNumber) list of the clicked point?

I hope to have been clear in explaining the problem.

Thanks for all the suggestions and hints



As of v1.28.0, the event data should include data.points[i].ids as desired.

Hi @etienne

first, thanks for the answer.

I download the latest plotly-latest.min.js from here (I load the js from local folder. I am also loading from the same local folder polyfill.min.js, Are there some compatibility problems?

So to the above for loop I just added the following line:


but the console prints undefined (while with console.log(data.points[i].x) the console prints the correct value).

Thanks for the help

Woops, I meant data.points[i].id

Perfect!! many many thanks!

plotly is really awesome

1 Like