When i click Settings button, i want graph to update according to it’s new size immediately, and it doesnt. It does only if i resize slightly the window itself, or if go to different browser tab.
What am i doing wrong?
I use dash_bootstrap_componens.
Callback:
@app.callback(
[Output("collapse_settings", "style"),
Output("pre-graph-div", "className")],
[Input("settings-button", "n_clicks")])
def toggle_collapse(n):
if not n:
return {'display': 'block'}, "col-md-9" #
if n % 2 == 1:
return {'display': 'none'}, "col-md-12" #
else:
return {'display': 'block'}, "col-md-9" #
Layout:
html.Div( id="pre-graph-div",
className="bg-light",
children=[
html.Div(
id="graph-div",
children=[
dcc.Graph(
id='output-graph',
figure={
'data': [
{'x': [], 'y': [], 'type': 'line', 'name': ''},
],
'layout': {
'title': ''
}
})
])
])