Graph selectedData update

Hello, I am new here,

I have a dash app that creates graphs dynamically. I want to add a feature that when user select a data one of that dynamically created graphs, other graphs also marked that position. I saw that the selected data attribute is read-only so I can’t change other graphs selected data attribute however I think I can change other graphs layout to add shapes or arrows to mark that position but again I can’t change a graph layout is there any example that changes a graphs layout dynamically?

And is there any update on multiple callback functions for one output? It will be very good for dynamically to create callback functions. Thanks for helping and thanks for creating the awesome Dash. React is too hard for me to create app’s like this.

Hello BSen. Welcome to the Dash Community! To do what you’re wanting to do here you would likely want to use to use dcc.State in your callback along these lines.

@app.callback(Output('graph1', 'figure'),
               [Input('graph2', 'selectedData')],
              [State('graph1', 'figure')])
def update_graph1(selected_data, figure):
    figure['layout'] = [whatever you want to change]
    return figure

However if your graphs are plotting a lot of data this will be costly in terms of performance. I would recommend looking into this post. Especially this response to help with that.

Best of luck to you BSen!

1 Like

Thank you Krichardson it’s worked. But still, I can’t find a way to do this on dynamically created elements and callbacks. I found this Callback for Dynamically created Graph I understand from here is that I can’t create dynamically created callbacks for dynamically created graphs currently.

Anyway, thank you so much.