Hi everyone,
I am trying to update the ‘toImageButtonOptions’ property in the dcc.graph config attribute without redrawing the graph.
The graph is a large network and I believe redrawing the graph is not an optimal solution.
here is my code for the callback to update the config attribute:
@app.callback(
Output('Large_Network', 'config'),
[Input("update_button", "n_clicks")],
[State("width", "value"),
State("height", "value"),
State("scale", "value"),
State("export_format", "value")]
)
def update_toImageButtonOptions(update_button_clicked, width, height, scale, export_format):
changed_id = [p['prop_id'] for p in dash.callback_context.triggered][0]
if 'update_button.n_clicks' in changed_id:
config = {
"editable": False,
"scrollZoom": True,
"displayModeBar": True,
"displaylogo": False,
'responsive': True,
'toImageButtonOptions': {
"format": export_format,
"filename": 'custom_image',
"height": height,
"width": width,
"scale": scale
}
}
else:
config={"editable": False,
"scrollZoom": True,
"displayModeBar": True,
"displaylogo": True,
}
return config
I know the callback passes the new config attribute but there is no change in toImageButtonOptions.
Thank you.