I am trying to create two linked plots. When you click a point in the fig_overview
plot, the fig_detail
plot should change to show a specific view for that.
To my eyes, I have followed this tutorial to the letter. The first plot and the initial dummy plot show up as expected. Unfortunately, the second figure does not update.
The code is running in WSL on Python 3.10.12, jupyterlab 4.1.8, dash 2.17.0.
app = Dash('prrdash', external_stylesheets=[dbc.themes.SOLAR])
app.layout = html.Div(children=[
dcc.Graph(id='fig_overview', figure=fig_overview(data)),
dcc.Graph(id='fig_detail', figure=fig_detail(data, None))
])
@app.callback(
Output('fig_detail', 'figure'),
Input('fig_overview', 'clickData')
)
def select_project(clickData):
if clickData is not None:
task = clickData['points'][0]['customdata'][0]
fig = fig_detail(data, task)
return fig
app.run()
What I have tried so far:
- Verifying the
task
extraction logic: I canprint(task)
insideselect_project()
and get the expected result. - Verifying the plot generator
fig_detail()
: I can even dofig.show()
inside the callback and get the expected result. - Vary
mode
andjupyter_mode
ofapp.run()
. - Vary the layout. The code already shows the stripped down version of the DOM.
- Vary the
id
s – that shows you how stumped I am. No, changing the names does not change anything. - I do have a work-around: wrapping the diagram in an additional
div
and replacing itschildren
with a whole newdcc.Graph
does work as intended. But I really would love to understand why this simplified approach fails!
Do you have any suggestions for what to try next? Or even just a little pointer on how to debug.