Update different graphs using the same callback

Hello,

I’m discovering dash with doing a monitoring app at work.
The issue I’m having is that I will have multiple graphs within the app which will update at regular interval. Is there a way to distinguish which graph I’m updating with the same callback ou should I write a different callback with different output for each graph ?

The callback would look something like this (data is DataFrames data)

@callback(Output('live-update-graph', 'figure'),
          Input('interval-component', 'n_intervals'))
def update_graph_live(n):
    if graph == 'dewar_temp':
        data = get_dewar()
    if graph == 'meteo':
        data = get_meteo()

    # Create the graph with subplots
    fig = data.plot()

    return fig

Thank you for your help, let me know if it’s not clear enough

Hello @Aprots,

Welcome to the community!

You can use a newer feature called set_props to update different figures based upon the needs of your function call at the time.

Sorry for the late reply but thanks a lot, that does exactly what i wanted !

1 Like