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

[ENH] Make map figure size (a little) more responsive #101

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
33 changes: 18 additions & 15 deletions climate_emotions_map/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

MAP_LAYOUT = {
"margin": {"l": 15, "r": 15, "t": 15, "b": 15},
"margin": {"l": 0, "r": 0, "t": 15, "b": 15},
"colormap_range_padding": 0,
}

Expand Down Expand Up @@ -409,35 +409,37 @@ def create_map_plot():
decimals=NUM_DECIMALS,
# opinion_colormap=OPINION_COLORMAP,
),
# vh = % of viewport height
# TODO: Revisit once plot margins are adjusted
config=DCC_GRAPH_CONFIG,
style={"height": "65vh"},
# NOTE: To verify centering/margins of figure, can apply a border
style={"maxHeight": "50vw", "height": "65vh"},
),
# set max width
# TODO: Revisit once plot margins are adjusted
# style={"maxWidth": "70vw"},
size="xl",
fluid=True,
w={"base": "100vw", "lg": "65vw"},
)
return us_map


def create_map_disclaimer():
"""Create the disclaimer for the map section of the dashboard."""
return dmc.Flex(
[
return dmc.Text(
children=[
html.I(
className="bi bi-exclamation-circle", style={"fontSize": 15}
className="bi bi-exclamation-circle",
style={
"fontSize": 15,
"display": "inline",
"verticalAlign": "middle",
},
),
dmc.Text(
children=SUPP_TEXT["map_disclaimer"],
fs="italic",
size="sm",
ms=5,
# ta="center",
style={"display": "inline", "verticalAlign": "middle"},
),
],
gap=5,
align="center",
)


Expand Down Expand Up @@ -483,7 +485,7 @@ def create_bar_plots_for_question(question_id: str, subquestion_id: str):
),
fluid=True,
# TODO: Reduce currently hard-coded L/R margins in Plotly fig to fill up more available width
w={"base": "100vw", "lg": 1000},
w={"base": "100vw", "lg": 1000, "xl": 1100},
# size="xl",
)
return figure
Expand Down Expand Up @@ -514,7 +516,7 @@ def create_selected_question_bar_plot():
),
fluid=True,
# TODO: Reduce currently hard-coded L/R margins in Plotly fig to fill up more available width
w={"base": "100vw", "lg": 1000},
w={"base": "100vw", "lg": 1000, "xl": 1100},
)

return dmc.Stack(
Expand Down Expand Up @@ -628,6 +630,7 @@ def create_main():
dmc.GridCol(
create_map_disclaimer(),
span="content",
style={"maxWidth": "100%"},
),
dmc.GridCol(
create_impact_dropdown(),
Expand Down
6 changes: 5 additions & 1 deletion climate_emotions_map/make_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ def make_map(
hoverinfo="none", # no hoverbox but click events are still emitted (?)
# TODO: revisit
# position colorbar closer to plot area (map)
colorbar={"x": 1},
colorbar={
"x": 0.95,
"thicknessmode": "fraction",
"lenmode": "fraction",
},
)

# add outline for clicked state
Expand Down