What I would love to be able to do it to click a node and it will copy the label from level 0 to the level you’re clicking. Maybe even in a pandas dataframe format like: df[(df.level_0 == “[label_0]”) & (df.level_1 == "[label_1])] etc. such that I could easily take a look at the specific data that node relates to.
If you want to get fancy, you could have the a click return value (or info that you need) that then updates these above values. The latter you need to use some javascript, here is an example:
Basically what you would like to do is update the clickData attribute, which you only care about the node name, and have that update the figure as follows:
@app.callback(
Output('sankey-graph', 'figure'),
[Input('basic-interactions', 'clickData')])
def update_sankey(clickData):
fig = go.Figure(###update values based on value)
return fig
Thanks a lot for your answers! Maybe I wasn’t very good at explaining what I wanted to do, but I don’t want to update the figure at all when clicking. I simply want to copy the labels of the node(s) to my clipboard so I can paste it in a Jupyter Notebook for instance.
Example: Let’s say the label of the node in level 0 was: “some_node_label” and the label of the top node in level 1 was “some_other_node_label”, then clicking the top node in my graph would copy the label of the previous node label in level 0, as well as the node label of the actual node I’m clicking, such that when I paste I get the following: df[(df[“level_0”] == “some_node_label”) & (df[“level_1”] == “some_other_node_label”)]