I have a boolean value from a radio_item with the id ‘dimension’. I want to use this value as a State in a clientside callback. The callback currently looks like this:
app.clientside_callback(
"""
function(fig) {
const x_range = fig.layout.xaxis.range;
const y_range = fig.layout.yaxis.range;
return JSON.stringify([x_range, y_range])
}
""",
Output('limits', 'children'),
Input('main-plot', 'figure'),
prevent_initial_call=True
)
I want it to become something like this:
app.clientside_callback(
"""
function(fig, dim) {
if dim {
return window.dash_clientside.no_update
} else {
const x_range = fig.layout.xaxis.range;
const y_range = fig.layout.yaxis.range;
return JSON.stringify([x_range, y_range])
}
}
""",
Output('limits', 'children'),
Input('main-plot', 'figure'),
State('dimension', 'value'), # this a boolean
prevent_initial_call=True
)
Many thanks.