mirror of
https://github.com/dylanbenzi/hurricane_normalization_app.git
synced 2026-07-29 21:01:27 +00:00
update growth trends dygraph
This commit is contained in:
+20
-4
@@ -918,11 +918,27 @@ fillCol(
|
|||||||
)
|
)
|
||||||
|
|
||||||
output$test_dy <- renderDygraph({
|
output$test_dy <- renderDygraph({
|
||||||
test_ts <- test_query()
|
req(growth_counties)
|
||||||
|
|
||||||
dygraph(test_ts, main = "Normalized Aggregate Growth") %>%
|
aggregated_growth <- growth_counties() %>%
|
||||||
dySeries("population_index", label = "Population") %>%
|
st_drop_geometry() %>%
|
||||||
dySeries("housing_index", label = "Housing Units") %>%
|
group_by(year) %>%
|
||||||
|
summarize(
|
||||||
|
avg_normalized_population = mean(normalized_population, na.rm = TRUE),
|
||||||
|
avg_normalized_housing = mean(normalized_housing, na.rm = TRUE)
|
||||||
|
) %>%
|
||||||
|
mutate(year = as.Date(paste0(year, "-01-01")))
|
||||||
|
|
||||||
|
result <- aggregated_growth %>%
|
||||||
|
select(year, avg_normalized_population, avg_normalized_housing)
|
||||||
|
|
||||||
|
result_ts <- result %>%
|
||||||
|
select(-year) %>%
|
||||||
|
xts(order.by = result$year)
|
||||||
|
|
||||||
|
dygraph(result_ts, main = "Normalized Growth") %>%
|
||||||
|
dySeries("avg_normalized_population", label = "Population", color = "red") %>%
|
||||||
|
dySeries("avg_normalized_housing", label = "Housing Units", color = "blue") %>%
|
||||||
dyRangeSelector()
|
dyRangeSelector()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user