Skip to content

Commit b457fe8

Browse files
committedMar 19, 2022
Stop using deprecated packages
Running the app I have just been warned that the two packages dash_{core,html}_components are deprecated and are now in the main dash module. This commit makes the necessary changes.
1 parent 2e66697 commit b457fe8

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed
 

‎app.py

+12-16
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
import dash_bootstrap_components as dbc
66

7-
import dash_core_components as dcc
8-
9-
import dash_html_components as html
10-
117
import plotly.express as px
128

139
import pynch.mass_table as mt
@@ -91,7 +87,7 @@ def update_graph(y_var, x_value, year):
9187
template="plotly_dark",
9288
)
9389

94-
title = html.H2(f"A = {x_value}")
90+
title = dash.html.H2(f"A = {x_value}")
9591

9692
min_a = df_f["A"].min()
9793
max_a = df_f["A"].max()
@@ -112,10 +108,10 @@ def update_graph(y_var, x_value, year):
112108
year_and_variable = dbc.Row(
113109
[
114110
dbc.Col(
115-
html.Div(
111+
dash.html.Div(
116112
[
117-
html.H3("Year"),
118-
dcc.Slider(
113+
dash.html.H3("Year"),
114+
dash.dcc.Slider(
119115
id="year_slider",
120116
min=0,
121117
max=len(table_years) - 1,
@@ -126,10 +122,10 @@ def update_graph(y_var, x_value, year):
126122
)
127123
),
128124
dbc.Col(
129-
html.Div(
125+
dash.html.Div(
130126
[
131-
html.H3("Value to plot"),
132-
dcc.Dropdown(
127+
dash.html.H3("Value to plot"),
128+
dash.dcc.Dropdown(
133129
id="yaxis_dropdown",
134130
options=[{"label": i, "value": i} for i in variables],
135131
value=variables[7],
@@ -143,17 +139,17 @@ def update_graph(y_var, x_value, year):
143139
a_slider = dbc.Row(
144140
dbc.Col(
145141
[
146-
html.Div(id="graph-title", children=[]),
147-
html.Div(dcc.Slider(id="xval_slider", value=50)),
142+
dash.html.Div(id="graph-title", children=[]),
143+
dash.html.Div(dash.dcc.Slider(id="xval_slider", value=50)),
148144
]
149145
)
150146
)
151147

152148
graphs = dbc.Row(
153149
[
154-
dbc.Col(dcc.Graph(id="n-graph", figure={}), width=3),
155-
dbc.Col(dcc.Graph(id="a-graph", figure={}), width=6),
156-
dbc.Col(dcc.Graph(id="z-graph", figure={}), width=3),
150+
dbc.Col(dash.dcc.Graph(id="n-graph", figure={}), width=3),
151+
dbc.Col(dash.dcc.Graph(id="a-graph", figure={}), width=6),
152+
dbc.Col(dash.dcc.Graph(id="z-graph", figure={}), width=3),
157153
]
158154
)
159155

0 commit comments

Comments
 (0)
Please sign in to comment.