I have a Dash app in python, with 2 dcc.Graph objects, each of them having their own callback. I’m using the “hoverData” attribute of one graph as Input to the other graph, similar to how it’s done in this tutorial about “update graph on hover”. However, for some reason, this callback only updates the graph on the initial loading of the Dash app. After that, it still runs the callback, but the callback doesn’t update the graph. My callback is given here:
@app.callback( dash.dependencies.Output('figure-2', 'figure'), dash.dependencies.Input(f'min', 'value'), dash.dependencies.Input(f'max', 'value'), dash.dependencies.Input('figure-1', 'hoverData'), *other_callback_inputs ) def update_graphx(min, max, hover, *args): fig = px.line(df, x=x, y=z) if hover is None: return None print('foo') return fig
When I change “return None” to “return fig”, it shows the graph. But when I keep it like this, it never shows the graph, even though it repeatedly prints “foo” when I hover over graph-1. Why could this be happening?