mirror of
https://github.com/dylanbenzi/hurricane_normalization_app.git
synced 2026-07-30 05:08:57 +00:00
fix card fill on storm explorer
This commit is contained in:
+9
-39
@@ -8,12 +8,12 @@ server <- function(input, output, session) {
|
||||
data = trimws(paste(
|
||||
ifelse(
|
||||
as.logical(.data[[col_names[3]]]),
|
||||
'<span class="badge badge-primary">Fatality</span>',
|
||||
"Fatality",
|
||||
""
|
||||
),
|
||||
ifelse(
|
||||
as.logical(.data[[col_names[4]]]),
|
||||
'<span class="badge badge-success">Cost</span>',
|
||||
"Cost",
|
||||
""
|
||||
)
|
||||
))
|
||||
@@ -630,54 +630,24 @@ server <- function(input, output, session) {
|
||||
)
|
||||
|
||||
output$growth_map <- renderLeaflet({
|
||||
req(
|
||||
growth_counties(),
|
||||
input$growth_trend_map_slider,
|
||||
input$growth_map_metric
|
||||
)
|
||||
leaflet() %>%
|
||||
addProviderTiles("Stadia.AlidadeSmooth")
|
||||
})
|
||||
|
||||
observe({
|
||||
req(growth_counties())
|
||||
|
||||
counties_data <- growth_counties()
|
||||
combined_geom <- st_union(counties_data)
|
||||
growth_bbox <- st_bbox(combined_geom)
|
||||
|
||||
growth_year <- input$growth_trend_map_slider
|
||||
growth_county_year <- counties_data %>%
|
||||
filter(year == growth_year)
|
||||
|
||||
map <- leaflet() %>%
|
||||
addProviderTiles("Stadia.AlidadeSmooth") %>%
|
||||
leafletProxy("growth_map") %>%
|
||||
fitBounds(
|
||||
lng1 = growth_bbox[["xmin"]],
|
||||
lng2 = growth_bbox[["xmax"]],
|
||||
lat1 = growth_bbox[["ymin"]],
|
||||
lat2 = growth_bbox[["ymax"]]
|
||||
)
|
||||
|
||||
if (input$growth_map_metric == "Population") {
|
||||
map <- map %>%
|
||||
addPolygons(
|
||||
data = growth_county_year,
|
||||
group = "counties",
|
||||
fillColor = "red",
|
||||
color = "red",
|
||||
fillOpacity = ~population_opacity,
|
||||
weight = 1,
|
||||
popup = ~name
|
||||
)
|
||||
} else {
|
||||
map <- map %>%
|
||||
addPolygons(
|
||||
data = growth_county_year,
|
||||
group = "counties",
|
||||
fillColor = "blue",
|
||||
color = "blue",
|
||||
fillOpacity = ~housing_opacity,
|
||||
weight = 1,
|
||||
popup = ~name
|
||||
)
|
||||
}
|
||||
|
||||
return(map)
|
||||
})
|
||||
|
||||
observe({
|
||||
|
||||
@@ -80,12 +80,11 @@ ui <- page_navbar(
|
||||
),
|
||||
nav_panel(
|
||||
title = "Storm Explorer",
|
||||
navset_underline(
|
||||
navset_card_underline(
|
||||
nav_item(strong(textOutput("selected_storm_name_year"))),
|
||||
nav_panel(
|
||||
"Track",
|
||||
layout_columns(
|
||||
col_widths = 6,
|
||||
layout_column_wrap(
|
||||
card(
|
||||
full_screen = TRUE,
|
||||
card_body(
|
||||
@@ -178,7 +177,12 @@ ui <- page_navbar(
|
||||
)
|
||||
),
|
||||
card(
|
||||
height = 500,
|
||||
card_body(
|
||||
class = "p-0",
|
||||
|
||||
leafletOutput("growth_map", height = "100%")
|
||||
)
|
||||
),
|
||||
card(
|
||||
fluidRow(
|
||||
|
||||
Reference in New Issue
Block a user