Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
],
),
html.Br(),
html.H4(children="Data per Canton", style={"color": theme["accent"]}),
html.H4(children="Data per Canton (Interpolated)", style={"color": theme["accent"]}),
html.Div(
className="row",
children=[
Expand All @@ -227,7 +227,7 @@
),
html.Br(),
html.H4(
children="Interpolated and Predicted Data", style={"color": theme["accent"]}
children="Data per Canton (Interpolated and Predicted)", style={"color": theme["accent"]}
),
html.Div(
className="row",
Expand Down Expand Up @@ -321,7 +321,7 @@ def update_case_graph(selected_cantons, selected_scale):
if canton in selected_cantons
],
"layout": {
"title": "Cases per Canton",
"title": "Cases per Canton (Real)",
"height": 750,
"xaxis": {"showgrid": True, "color": "#ffffff"},
"yaxis": {"type": selected_scale, "showgrid": True, "color": "#ffffff"},
Expand Down Expand Up @@ -349,7 +349,7 @@ def update_case_pc_graph(selected_cantons, selected_scale):
if canton in selected_cantons
],
"layout": {
"title": "Cases per Canton (per 10,000 Inhabitants)",
"title": "Cases per Canton per 10,000 Inhabitants (Real)",
"height": 750,
"xaxis": {"showgrid": True, "color": "#ffffff"},
"yaxis": {"type": selected_scale, "showgrid": True, "color": "#ffffff"},
Expand All @@ -361,34 +361,37 @@ def update_case_pc_graph(selected_cantons, selected_scale):


#
# Total cases Switzerland
# Total cases Switzerland (real)
#
@app.callback(
Output("case-ch-graph", "figure"), [Input("radio-scale", "value")],
)
def update_case_ch_graph(selected_scale):
return {
trace = {
"data": [
{
"x": data["Date"],
"y": data[canton],
"name": canton,
"marker": {"color": theme["foreground"]},
"type": "bar",
"text": data[canton],
"textposition": "auto",
}
for i, canton in enumerate(data)
if canton != "Date" and canton == "CH"
],
"layout": {
"title": "Total Cases Switzerland",
"title": "Total Cases Switzerland (Real)",
"height": 400,
"xaxis": {"showgrid": True, "color": "#ffffff"},
"xaxis": {"showgrid": True, "color": "#ffffff", "tickangle": "-45"},
"yaxis": {"type": selected_scale, "showgrid": True, "color": "#ffffff"},
"plot_bgcolor": theme["background"],
"paper_bgcolor": theme["background"],
"font": {"color": theme["foreground"]},
},
}
}
return trace


#
Expand All @@ -397,29 +400,32 @@ def update_case_ch_graph(selected_scale):
@app.callback(
Output("case-ch-graph-pred", "figure"), [Input("radio-scale", "value")],
)
def update_case_ch_graph_pred(selected_scale):
return {
def update_case_ch_graph_pred(selected_scale):
trace = {
"data": [
{
"x": data_pred["Date"],
"y": data_pred[canton],
"name": canton,
"marker": {"color": theme["foreground"]},
"type": "bar",
"text": data_pred[canton],
"textposition": "auto",
}
for i, canton in enumerate(data)
if canton != "Date" and canton == "CH"
],
"layout": {
"title": "Predicted Total Cases Switzerland",
"title": "Total Cases Switzerland (Predicted)",
"height": 400,
"xaxis": {"showgrid": True, "color": "#ffffff"},
"xaxis": {"showgrid": True, "color": "#ffffff", "tickangle": "-45"},
"yaxis": {"type": selected_scale, "showgrid": True, "color": "#ffffff"},
"plot_bgcolor": theme["background"],
"paper_bgcolor": theme["background"],
"font": {"color": theme["foreground"]},
},
}
return trace


#
Expand All @@ -442,7 +448,7 @@ def update_case_graph_pred(selected_cantons, selected_scale):
if canton in selected_cantons
],
"layout": {
"title": "Cases per Canton",
"title": "Cases per Canton (Predicted)",
"height": 750,
"xaxis": {"showgrid": True, "color": "#ffffff"},
"yaxis": {"type": selected_scale, "showgrid": True, "color": "#ffffff"},
Expand Down Expand Up @@ -473,7 +479,7 @@ def update_case_pc_graph_pred(selected_cantons, selected_scale):
if canton in selected_cantons
],
"layout": {
"title": "Cases per Canton (per 10,000 Inhabitants)",
"title": "Cases per Canton per 10,000 Inhabitants (Predicted)",
"height": 750,
"xaxis": {"showgrid": True, "color": "#ffffff"},
"yaxis": {"type": selected_scale, "showgrid": True, "color": "#ffffff"},
Expand All @@ -486,9 +492,9 @@ def update_case_pc_graph_pred(selected_cantons, selected_scale):

if __name__ == "__main__":
app.run_server(
# debug=True,
# dev_tools_hot_reload=True,
# dev_tools_hot_reload_interval=5000,
# dev_tools_hot_reload_max_retry=30,
#debug=True,
#dev_tools_hot_reload=True,
#dev_tools_hot_reload_interval=5000,
#dev_tools_hot_reload_max_retry=30,
)