Add Graph display on comparison page

This commit is contained in:
2026-01-07 22:09:11 +01:00
parent f5c0c94e77
commit b0018a1615

View File

@@ -14,6 +14,10 @@ server <- function(input, output, session) {
currently_selected_maptype <- reactiveVal("Bezirke") currently_selected_maptype <- reactiveVal("Bezirke")
currently_selected_heatmap_crime <- reactiveVal("Allgemeine Verstöße gem. § 29 BtMG -Konsumentendelikte-") currently_selected_heatmap_crime <- reactiveVal("Allgemeine Verstöße gem. § 29 BtMG -Konsumentendelikte-")
currently_compared_location <- reactiveVal(c(""))
currently_compared_crimes <- reactiveVal(c(""))
# 1. Aktualisieren der Auswahlmöglichkeiten mit den extrahierten Schlüsselnamen # 1. Aktualisieren der Auswahlmöglichkeiten mit den extrahierten Schlüsselnamen
updateSelectizeInput( updateSelectizeInput(
session = session, session = session,
@@ -242,12 +246,22 @@ server <- function(input, output, session) {
}, res = 100) }, res = 100)
output$tbl_2024 <- renderTable( observeEvent(input$vergleich_location, {
map_data_to_table( currently_compared_location(c(input$vergleich_location))
bezirk = currently_selected_bezirk(), })
stadtteil = currently_selected_stadtteil(), observeEvent(input$vergleich_straftat, {
currently_compared_crimes(input$vergleich_straftat)
})
output$vergleich_balkendiagramm <- renderPlot({
data_tibble <- map_data_to_plot(
locations = currently_compared_location(),
crimes = currently_compared_crimes(),
year = "2024" year = "2024"
),
striped = TRUE
) )
ggplot(data_tibble, aes(x = Location, y = Erfasst, group = Name, fill = Name)) +
geom_col(position = position_dodge(width = 0.9))
}, res = 100)
} }