# Getting other data than x, y pointNumber

**URL:** <https://community.plotly.com/t/getting-other-data-than-x-y-pointnumber/5627>\
**Category:** plotly.js\
**Created:** [September 1, 2017, 2:05pm UTC](https://community.plotly.com/t/getting-other-data-than-x-y-pointnumber/5627 "2017-09-01T14:05:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghtmtt](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/ghtmtt/32/51_2.png) [@ghtmtt](https://community.plotly.com/u/ghtmtt)\
**Post date:** [September 1, 2017, 2:05pm UTC](https://community.plotly.com/t/getting-other-data-than-x-y-pointnumber/5627/1 "2017-09-01T14:05:08Z")

</div>

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](https://plot.ly/javascript/plotlyjs-events/#event-data) some _variables_ are easy returned, like curveNumber, pointNumber, x, y and data:

something like:

```
var plotly_data = plotly_div.data
    for(var i=0; i < data.points.length; i++){
        data.points[i].x
        data.points[i].pointNumber
        data.points[i].y
   }

```

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

Cheers

Matteo

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [September 1, 2017, 3:22pm UTC](https://community.plotly.com/t/getting-other-data-than-x-y-pointnumber/5627/2 "2017-09-01T15:22:56Z")

</div>

As of [`v1.28.0`](https://github.com/plotly/plotly.js/releases/tag/v1.28.0), the event data should include `data.points[i].ids` as desired.

---

<div class="post-metadata">

**Author:** ![ghtmtt](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/ghtmtt/32/51_2.png) [@ghtmtt](https://community.plotly.com/u/ghtmtt)\
**Post date:** [September 1, 2017, 4:33pm UTC](https://community.plotly.com/t/getting-other-data-than-x-y-pointnumber/5627/3 "2017-09-01T16:33:05Z")

</div>

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:

`console.log(data.points[i].ids)`

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

Thanks for the help

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [September 1, 2017, 5:07pm UTC](https://community.plotly.com/t/getting-other-data-than-x-y-pointnumber/5627/4 "2017-09-01T17:07:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ghtmtt](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/ghtmtt/32/51_2.png) [@ghtmtt](https://community.plotly.com/u/ghtmtt)\
**Post date:** [September 1, 2017, 6:41pm UTC](https://community.plotly.com/t/getting-other-data-than-x-y-pointnumber/5627/5 "2017-09-01T18:41:53Z")

</div>

Perfect!! many many thanks!

plotly is really awesome
