I’m trying to create a Dash app that creates a graph (it’s set up to create an initial scatter plot on a specifically-sized grid using a custom class based around a numpy array) and then uses an Interval callback to run a class method on the array and re-create the graph.
I’m running into trouble figuring out how to create the callback. I need to be able to pass the initial array into the live-update function in order to update it, but it seems like the callback only allows a function to call “n” for the number of intervals, and nothing else.
I need something like:
@app.callback(Output('live-update-graph', 'figure'), [Input('interval-component', 'n_intervals')]) def update_graph_live(n, array): array.update_array() fig = create_plot(array) return fig
but that doesn’t work because there’s an unexpected input in the function. It doesn’t seem to work to add a place for it to the Input list either.
Is there a way to do this? Or am I coming at this problem all wrong?