Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom dropdown component #217

Merged
Show file tree
Hide file tree
Changes from 2 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
63 changes: 15 additions & 48 deletions my_project/tab_data_explorer/app_data_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
code_timer,
title_with_link,
determine_month_and_hour_filter,
dropdown,
)

from my_project.global_scheme import (
Expand Down Expand Up @@ -56,14 +57,10 @@ def section_one_inputs():
className="container-row full-width row-center",
children=[
html.H4(className="text-next-to-input", children=["Select a variable: "]),
dcc.Dropdown(
dropdown(
id="sec1-var-dropdown",
options=[
{"label": i, "value": explore_dropdown_names[i]}
for i in explore_dropdown_names
],
options=explore_dropdown_names,
value="DBT",
clearable=False,
),
],
)
Expand Down Expand Up @@ -225,18 +222,11 @@ def section_two_inputs():
children=["Variable:"],
style={"flex": "30%"},
),
dcc.Dropdown(
dropdown(
id="sec2-var-dropdown",
options=[
{
"label": i,
"value": explore_dropdown_names[i],
}
for i in explore_dropdown_names
],
options=explore_dropdown_names,
value="RH",
style={"flex": "70%"},
clearable=False,
),
],
),
Expand Down Expand Up @@ -333,18 +323,11 @@ def section_two_inputs():
children=["Filter Variable:"],
style={"flex": "30%"},
),
dcc.Dropdown(
dropdown(
id="sec2-data-filter-var",
options=[
{
"label": i,
"value": explore_dropdown_names[i],
}
for i in explore_dropdown_names
],
options=explore_dropdown_names,
value="RH",
style={"flex": "70%"},
clearable=False,
),
],
),
Expand Down Expand Up @@ -430,47 +413,35 @@ def section_three_inputs():
className=container_row_center_full,
children=[
html.H6(style={"flex": "30%"}, children=["X Variable:"]),
dcc.Dropdown(
dropdown(
id="tab6-sec3-var-x-dropdown",
options=[
{"label": i, "value": explore_dropdown_names[i]}
for i in explore_dropdown_names
],
options=explore_dropdown_names,
value="DBT",
style={"flex": "70%"},
clearable=False,
),
],
),
html.Div(
className=container_row_center_full,
children=[
html.H6(style={"flex": "30%"}, children=["Y Variable:"]),
dcc.Dropdown(
dropdown(
id="tab6-sec3-var-y-dropdown",
options=[
{"label": i, "value": explore_dropdown_names[i]}
for i in explore_dropdown_names
],
options=explore_dropdown_names,
value="RH",
style={"flex": "70%"},
clearable=False,
),
],
),
html.Div(
className=container_row_center_full,
children=[
html.H6(style={"flex": "30%"}, children=["Color By:"]),
dcc.Dropdown(
dropdown(
id="tab6-sec3-colorby-dropdown",
options=[
{"label": i, "value": explore_dropdown_names[i]}
for i in explore_dropdown_names
],
options=explore_dropdown_names,
value="glob_hor_rad",
style={"flex": "70%"},
clearable=False,
),
],
),
Expand Down Expand Up @@ -564,15 +535,11 @@ def section_three_inputs():
html.H6(
children=["Filter Variable:"], style={"flex": "30%"}
),
dcc.Dropdown(
dropdown(
id="tab6-sec3-filter-var-dropdown",
options=[
{"label": i, "value": explore_dropdown_names[i]}
for i in explore_dropdown_names
],
options=explore_dropdown_names,
value="RH",
style={"flex": "70%"},
clearable=False,
),
],
),
Expand Down
16 changes: 4 additions & 12 deletions my_project/tab_outdoor_comfort/app_outdoor_comfort.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
container_row_center_full,
container_col_center_one_of_three,
)
from my_project.utils import dropdown
from dash.dependencies import Input, Output, State

from my_project.template_graphs import (
Expand Down Expand Up @@ -42,20 +43,11 @@ def inputs_outdoor_comfort():
children=["Select a scenario:"],
style={"flex": "30%"},
),
dcc.Dropdown(
dropdown(
id="tab7-dropdown",
style={
"flex": "60%",
},
options=[
{
"label": i,
"value": outdoor_dropdown_names[i],
}
for i in outdoor_dropdown_names
],
style={"flex": "60%"},
options=outdoor_dropdown_names,
value="utci_Sun_Wind",
clearable=False,
),
html.Div(id="image-selection", style={"flex": "10%"}),
],
Expand Down
17 changes: 5 additions & 12 deletions my_project/tab_psy_chart/app_psy_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
generate_custom_inputs_psy,
determine_month_and_hour_filter,
title_with_link,
dropdown,
)
from my_project.global_scheme import (
dropdown_names,
Expand Down Expand Up @@ -64,17 +65,13 @@ def inputs():
children=["Color By:"],
style={"flex": "30%"},
),
dcc.Dropdown(
dropdown(
id="psy-color-by-dropdown",
options=[
{"label": i, "value": psy_dropdown_names[i]}
for i in psy_dropdown_names
],
options=psy_dropdown_names,
value="Frequency",
style={"flex": "70%"},
persistence_type="session",
persistence=True,
clearable=False,
),
],
),
Expand Down Expand Up @@ -168,15 +165,11 @@ def inputs():
html.H6(
children=["Filter Variable:"], style={"flex": "30%"}
),
dcc.Dropdown(
dropdown(
id="psy-var-dropdown",
options=[
{"label": i, "value": dropdown_names[i]}
for i in dropdown_names
],
options=dropdown_names,
value="RH",
style={"flex": "70%"},
clearable=False,
),
],
),
Expand Down
31 changes: 10 additions & 21 deletions my_project/tab_sun/app_sun.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
month_lst,
mapping_dictionary,
)
from my_project.utils import dropdown
from dash.dependencies import Input, Output, State

from my_project.tab_sun.charts_sun import (
Expand Down Expand Up @@ -68,15 +69,14 @@ def sun_path():
children=["View: "],
style={"width": "10rem"},
),
dcc.Dropdown(
dropdown(
id="custom-sun-view-dropdown",
options=[
{"label": "Spherical", "value": "polar"},
{"label": "Cartesian", "value": "cartesian"},
],
options={
"Spherical": "polar",
"Cartesian": "cartesian",
},
value="polar",
style={"width": "10rem"},
clearable=False,
),
],
),
Expand All @@ -89,15 +89,11 @@ def sun_path():
children=["Select variable: "],
style={"width": "10rem"},
),
dcc.Dropdown(
dropdown(
id="custom-sun-var-dropdown",
options=[
{"label": i, "value": sc_dropdown_names[i]}
for i in sc_dropdown_names
],
options=sc_dropdown_names,
value="None",
style={"width": "20rem"},
clearable=False,
),
],
),
Expand Down Expand Up @@ -131,18 +127,11 @@ def explore_daily_heatmap():
children=["Select variable: "],
style={"width": "10rem"},
),
dcc.Dropdown(
dropdown(
id="tab4-explore-dropdown",
options=[
{
"label": i,
"value": sun_cloud_tab_explore_dropdown_names[i],
}
for i in sun_cloud_tab_explore_dropdown_names
],
options=sun_cloud_tab_explore_dropdown_names,
value="glob_hor_rad",
style={"width": "20rem"},
clearable=False,
),
],
),
Expand Down
12 changes: 3 additions & 9 deletions my_project/tab_t_rh/app_t_rh.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
title_with_tooltip,
summary_table_tmp_rh_tab,
title_with_link,
dropdown,
)
from my_project.template_graphs import heatmap, yearly_profile, daily_profile
from my_project.global_scheme import dropdown_names
Expand All @@ -28,18 +29,11 @@ def layout_t_rh():
html.H4(
className="text-next-to-input", children=["Select a variable: "]
),
dcc.Dropdown(
dropdown(
id="dropdown",
className="dropdown-t-rh",
options=[
{
"label": var,
"value": dropdown_names[var],
}
for var in var_to_plot
],
options={var: dropdown_names[var] for var in var_to_plot},
value=dropdown_names[var_to_plot[0]],
clearable=False,
),
],
),
Expand Down
Loading
Loading