Black Lives Matter. Please consider donating to Black Girls Code today.

Custom datapoint attributes in a scatterplot [answered]

I would like to use a custom attribute to allow me to “link” points between various charts. What is the correct way to add a custom, unique attribute value (e.g. key=‘item1@item2@item3’) to each point?

It’d be nice if I could do something like:
customattributes: {
attributename: [‘v1’,‘v2’,‘v3’],
anotherattributename: anotherarrayofvalues
}]; is exactly what you’re looking for.

But ‘customdata’ assigns the values to the __data__ property of the DOM element. I would like to create a custom attribute for each g.point element so that I can use JQuery to create a collection of points.

Actually, I think I can use the ‘ids’ array to accomplish what I need, but a custom attribute would be easier in that I would not have to ensure uniqueness…

Try listening to plotly_hover, you should get back the point’s customdata item.