I received this Error Loading Dependencies when I updated the id to “date_slider” for my dynamic slider.
@app.callback(
dash.dependencies.Output(“graph”, “figure”),
[dash.dependencies.Input(“dropdown”, “value”),
dash.dependencies.Input(“date_slider”, “value”)])
Sorry I’m new here but is this the correct way of implementing? I want the value I chose on my slider to be captured in the def update_graph @app.callback so that it will dynamically plot the graph when I choose a value on the slider. Thanks!
app.layout = html.Div([
dcc.Dropdown(
id='dropdown',
options=options, value = options[0]["value"]
),
html.Div(id = "Slider"),
html.Hr(),
dcc.Graph(id="graph", style={"height": 800}),
html.Hr() ])
@app.callback(
dash.dependencies.Output("Slider", "children"),
[dash.dependencies.Input("dropdown", "value")])
def date(selected_node):
dates_model = [*models_changed[selected_node].keys()]
middle = round((len(dates_model)) / 2)
max_ = len(dates_model) - 1
mark = [0, middle, max_]
marks = {i: {"label":str(dates_model[i]), "style": {"writing-mode":"vertical-lr", "text-orientation": "sideways",
"margin-bottom":"50px", "margin-left":"20px",
"margin-right": "20px"}} for i in mark}
return dcc.Slider(id = "date_slider", min = 0, max = max_, value = 0,
marks = marks)
@app.callback(
dash.dependencies.Output("graph", "figure"),
[dash.dependencies.Input("dropdown", "value"),
dash.dependencies.Input("date_slider", "value")])
def update_graph(selected_node, selected_date):
dates_model = [*models_changed[selected_node].keys()]
dates_model = dates_model[selected_date]
node = models_changed[selected_node][dates_model]