update growth trends to select on storm selection

This commit is contained in:
2025-07-22 00:06:28 -04:00
parent 28aa97777d
commit 564d409716
+21 -6
View File
@@ -801,12 +801,17 @@ test_storm <- reactiveValues(
)
test_counties <- reactive({
req(storm_selection$is_selected)
req(
storm_selection$is_selected,
input$growth_trend_lf_select
)
counties <- get_normalized_metric_growth(test_storm, "LF1")
selected_lf <- input$growth_trend_lf_select
counties <- get_normalized_metric_growth(storm_selection, selected_lf)
result <- counties %>%
filter(year == 2024) %>%
#filter(year == 2024) %>%
mutate(
population_opacity = rescale(
normalized_population,
@@ -837,9 +842,19 @@ output$housing_growth_map <- renderLeaflet({
})
observe({
req(test_counties)
req(
test_counties,
input$growth_trend_map_slider
)
leafletProxy("pop_growth_map", data = test_counties()) %>%
growth_year <- input$growth_trend_map_slider
test_county_year <- test_counties() %>%
filter(
year == growth_year
)
leafletProxy("pop_growth_map", data = test_county_year) %>%
clearShapes() %>%
addPolygons(
fillColor = "red",
@@ -848,7 +863,7 @@ observe({
weight = 2
)
leafletProxy("housing_growth_map", data = test_counties()) %>%
leafletProxy("housing_growth_map", data = test_county_year) %>%
clearShapes() %>%
addPolygons(
fillColor = "blue",