Extended click event. Get what point or trace is clicked

Is there a way to receive click event (or filter existing one) when one of my trace is clicked or when particular point is clicked. Right now on click event I received point for each trace I have

If hovermode is set to ‘closest’ then click event will return only one point and not one for each trace

var layout: PlotlyLayout = {

hovermode: ‘closest’

here’s an example of a workaround: http://codepen.io/etpinard/pen/ZWwqoy

Hiya! Plotly now has improved and consolidated Plotly.js event documentation here:

Please feel free to suggest documentation improvements in a pull request:


Has anyone found a better way to do this? I’ve tried using the code in the codepen, but it isn’t accurate enough to ascertain the exact item clicked on a scatter plot with multiple traces, I need to be able to work my way back to the label of the line that was clicked.