diff --git a/dashboard.Rmd b/dashboard.Rmd index 26875e8..a85c97e 100644 --- a/dashboard.Rmd +++ b/dashboard.Rmd @@ -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",