My becomes bigger and bigger and I want to place a number of objects outside the app layout. In order to use them, I will use a callback to select one of them to show in the app. However, it seems like I can’t use this approach as dash doesn’t allow to call a non-existent object. Any ideas to solve it?
Here is an example of using a callback to return one of two options (line and scatter plot settings, pls see two photos below).
"""# Callback function to select plot types"""
prevent_initial_call=False, ## Must be False as the 'virtual' objects have to be identified first
def show_plot_options(figure, selectedRows):
if selectedRows is None:
selected_trace = selectedRows["trace_name"]
fig_data = figure["data"]
plot_type = None
for row in fig_data:
if row['name'] == selected_trace:
plot_type = row['mode']
if plot_type == "markers":
if plot_type == "lines+markers":
print("Chosen Line + Symbol")
I meant the objects such as several html.Div containing control parameters using Buttons, Select, etc are called only by a dropdown object. This means that when you can select one item at the beginning and the other html.Div are infact not associated with the layout and can’t be called.
Surely, if you put all of them in a single callback, it will work. But I have a large set of objects to producing a lot of parameters, so it’s not wise to do so.
The above example is abit different that when you select a trace in the figure, you can have its own control parameters and even recall previous parameters that have been set.