modify file formatting

This commit is contained in:
2026-04-07 22:25:40 -04:00
parent a5614049d7
commit b69812942c
3 changed files with 62 additions and 67 deletions
-1
View File
@@ -546,4 +546,3 @@ get_county_and_state <- function(df) {
return(result)
}
+55 -58
View File
@@ -135,6 +135,13 @@ server <- function(input, output, session) {
choices = unique_lfs$full_lf_id,
selected = unique_lfs$full_lf_id[1]
)
updateSliderInput(
session,
"growth_trend_map_slider",
min = storm_selection$storm_year,
value = storm_selection$storm_year
)
})
observeEvent(input$load_storm, {
@@ -304,12 +311,7 @@ server <- function(input, output, session) {
arrange(datetime)
return(result)
}) %>%
bindCache(
storm_selection$storm_year,
storm_selection$storm_name,
storm_selection$storm_basin
)
})
output$track_map <- renderLeaflet({
track_data <- storm_track()
@@ -541,19 +543,19 @@ server <- function(input, output, session) {
dyOptions(drawGrid = FALSE) %>%
dyLegend(show = "always")
Reduce(function(g, i) {
g %>% dyShading(
Reduce(
function(g, i) {
g %>%
dyShading(
from = track_data$datetime[i],
to = track_data$datetime[i + 1],
color = paste0(track_data$line_color[i], "33")
)
}, seq_len(nrow(track_data) - 1), init = g)
}) %>%
bindCache(
storm_selection$storm_year,
storm_selection$storm_name,
storm_selection$storm_basin
},
seq_len(nrow(track_data) - 1),
init = g
)
})
storm_yearly_normalization <- reactive({
req(
@@ -565,12 +567,7 @@ server <- function(input, output, session) {
result <- get_all_normalized_cost_index(storm_selection)
return(result)
}) %>%
bindCache(
storm_selection$storm_year,
storm_selection$storm_name,
storm_selection$storm_basin
)
})
output$cost_index_chart <- renderDygraph({
req(
@@ -648,30 +645,6 @@ server <- function(input, output, session) {
dyAxis("x", drawGrid = F) %>%
dyLegend(show = "always", width = 400, hideOnMouseOut = FALSE) %>%
dyRangeSelector()
}) %>%
bindCache(
storm_selection$storm_year,
storm_selection$storm_name,
storm_selection$storm_basin,
input$storm_overview_cost_index_lf_select,
input$storm_overview_cost_index_mmh_mmp,
input$storm_overview_cost_index_scale,
input$storm_overview_cost_index_y_scale
)
observe({
req(
storm_selection$storm_basin,
storm_selection$storm_year,
storm_selection$storm_name
)
updateSliderInput(
session,
"growth_trend_map_slider",
min = storm_selection$storm_year,
value = storm_selection$storm_year
)
})
growth_counties <- reactive({
@@ -703,33 +676,57 @@ server <- function(input, output, session) {
st_as_sf(wkt = "geom_wkt")
return(result)
}) %>%
bindCache(
storm_selection$storm_year,
storm_selection$storm_name,
storm_selection$storm_basin,
input$growth_trend_lf_select
)
output$growth_map <- renderLeaflet({
leaflet() %>%
addProviderTiles("Stadia.AlidadeSmooth")
})
observe({
req(growth_counties())
output$growth_map <- renderLeaflet({
req(
growth_counties(),
input$growth_trend_map_slider,
input$growth_map_metric
)
counties_data <- growth_counties()
combined_geom <- st_union(counties_data)
growth_bbox <- st_bbox(combined_geom)
leafletProxy("growth_map") %>%
growth_year <- input$growth_trend_map_slider
growth_county_year <- counties_data %>%
filter(year == growth_year)
map <- leaflet() %>%
addProviderTiles("Stadia.AlidadeSmooth") %>%
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({
-1
View File
@@ -147,7 +147,6 @@ ui <- page_navbar(
)
)
),
nav_panel("Meterology"),
nav_panel(
"Cost Normalization",
layout_columns(