No click event detected for sankey nodes when arrangement is snap

I’m creating a sankey diagram and am looking for a way to be able to select nodes by clicking/shift clicking. I have found that the plotly_click only works when the arrangement is fixed. Is there a way to get this when the arrangement is snap. I have also tried standard click events on the div but the events are never fired when hovering over a node with the arrangement as snap. Any ideas?

Hello @hsinclair,

Welcome to the community!

Would you please create an jsfiddle that you can post in the forums for us to test out and see if we can get what you desire working?

Here’s a link JSFiddle - Code Playground](Edit fiddle - JSFiddle - Code Playground)

When the arrangement is snap then the plotly_click event is only fired when clicking on a link and not a node. When the arrangement is fixed then both node and link fire an event. I’m trying to find a way that I can have the arrangement as snap and have the plotly_click event fire on a node and link. Thanks

Thanks for the jsfiddle, @hsinclair.

This is due to the click event changing into a restyle event for the nodes. You can add both listeners to log in the console. Not sure if this helps or not. :slight_smile:

Ah perfect I think I can make the restyle event work. Wasn’t aware of this thanks :slight_smile:

1 Like