Hello,
I tried the method suggested by @chriddyp in this community post on my scatter plot but the trace visibility (toggled by clicking on the trace legends) doesn’t persist between callbacks. Would passing the specific traces in a callback fix this? If so is there a way I can specifically access the toggled traces in a callback? If not, any tips other tips? Any help would be greatly appreciated.
Thanks In Advance!
Here’s my code
app.layout = html.Div([
html.Div(
style={'font-family': 'Product Sans'},
children=dcc.Dropdown(
id='device-dropdown',
options=dropdown_options,
multi=True,
placeholder='Select the devices you want to display',
value=[]
),
),
dcc.Graph(id='live-update-graph'),
dcc.Interval(
id='interval-component',
interval=1.5*1000, # in milliseconds
n_intervals=0
),
html.P(id='temp')
])
# Multiple components can update everytime interval gets fired.
@app.callback(Output('live-update-graph', 'figure'),
[Input('device-dropdown', 'value'),
Input('interval-component', 'n_intervals')],
[State('live-update-graph', 'figure')])
def update_graph_live(devices, n, previous_figure):
power, net_traff = get_power_and_net_traff(devices)
return create_figure_temp(devices, power, net_traff)