I have a stacked bar chart which has multiple traces. Is it possible to get only one point from the 3 traces (without having to use select and filter)? I know as of now when using hoverData and clickData with multiple traces, it returns an array of all the points. Possibly using the location of the mouse?
I meant when I have a stacked bar chart (partial shown) and I mouse over the stack, but I click on the blue trace. Is it possible to get only the data for a single trace? Because so far when I get clickData or hoverData, my points is an array of 3 elements - for all 3 values under that year.
I don’t believe that it is possible to discern which bar was clicked on since plotly.js assumes that all bars were clicked on. However, if you change 'layout': {'hovermode': 'closest'}, then you should be able to click on a single bar and get the event data just for that bar.
so, if understand this correctly, then there’s no way to have hovermode=compare so that the text will show up for all the sections of the bar, and still get the granular data that hovermode=closest would give?
I see. No, I don’t think there is right now. However, it seems like something that would be useful to add. Could you make an issue in plotly.js (https://github.com/plotly/plotly.js) about “adding data to the click event to discern which bar out of several was clicked”? And please refer that issue back to this community discussion and vice versa.