Hi, I am not sure whether this is a bug but I cannot find any resource about it online or in your bug list.
When subscribing to the 'plotly_onclick' listener on a stacked or clustered bar chart, the event currently returned is all the series within a category. However there is no property within the points to indicate which series in particular was clicked, only the category.
Is there a potential workaround for it at this time or could this eventually be implemented as a small tweak?
Thank you!
Yeah. That would be great.
Someone has asked for it before in http://community.plot.ly/t/add-functionality/971/19
I can't think of an easy workaround unfortunately.
Ah okay that would be an excellent feature either way. Thank you for commenting back!
maybe, it's possible to capture click position, and use axis scales and traces data to calculate, which one would be positioned where click happend?
Here's an UBER hacky solution: http://codepen.io/etpinard/pen/ZWwqoy
With Plotly version 1.21.2 (this could of also existed in earlier releases without realising), this is now possible, see the following codepen example:
Stacked demo
Using the 'relative' example from the plotly.js page, you can see that by setting the hovermode to 'closest' now gives you the accuracy. Hope this helps! :)
For those of you who are coming here looking for a solution to isolating what series you clicked on in a stacked bar chart and perhaps associating a key with that click and finding @DevJazz Code Pen missing. I've added an example highlighting the hovermode: 'closest' functionality that is not well documented. https://codepen.io/DM00000
Most helpful comment
Here's an UBER hacky solution: http://codepen.io/etpinard/pen/ZWwqoy