How to refresh data?

How do you re-read data from CSV files to update graphs using dcc.Interval as the trigger?

hi @twessels

With a callback where the input is n_intervals and the output is the data taken from the file.

Like:

@app.callback(Output('my-graph', 'figure'),
              Input('interval-component', 'n_intervals'))
def update_data(n):
    table = pd.read_csv(table)
    
    figure = bild the figure with the table

    return figure

see examples here:

https://dash.plotly.com/live-updates

1 Like