Hello, new learner here. I am looking for a way to make a callback repetitive. I am using plotly.subplots
with a variable amount of subplots. Right now I have a callback which starts a for-loop
that needs to crunch data incrementally, one graph at a time. Dash only updates at the end of the for-loop
. This is the dumbed-down version of the code:
@app.callback(Output('graph', 'figure'), Input('trace', 'n_clicks'), State('graph', 'figure')],
running=[(Output('trace', 'disabled'), True, False)], prevent_initial_call=True)
def update_figure(n_clicks, fig):
fig = go.Figure(fig) # Redefine figure
subplot = subplots.make_subplots(figure=fig) # Redefine subplot
for item in list:
data = cruncher.crunch(item) # Data crunch w/ 'item' corr. to row/col
subplot.add_trace(subplot,data, row, col) # trace added to bank
return fig # Graph updates all at once
I want to give it some of that dynamic spice.
I’m looking for a way to see each graph as they come, not all at the end. I have tried using chained callbacks
but keep getting circular dependency error
which makes sense. Any ideas?