Add Hamburg CI colors
This commit is contained in:
@@ -52,7 +52,6 @@ map_data_to_top3_plot <- function(bezirk, stadtteil, year) {
|
|||||||
# Beschränken: Wählt die Zeilen 2, 3 und 4 aus.
|
# Beschränken: Wählt die Zeilen 2, 3 und 4 aus.
|
||||||
# Dies sind die Ränge 2, 3 und 4.
|
# Dies sind die Ränge 2, 3 und 4.
|
||||||
slice(2:4)
|
slice(2:4)
|
||||||
#top_3_tibble$Name_wrapped <- str_wrap(top_3_tibble$Name, width = 25) #mit wrap ein umbruch bei den namen eingefügt
|
|
||||||
|
|
||||||
return(top_3_tibble)
|
return(top_3_tibble)
|
||||||
}
|
}
|
||||||
@@ -83,7 +82,7 @@ auswahlmöglichkeiten <- crime_json %>%
|
|||||||
ui <- function() {
|
ui <- function() {
|
||||||
page_fillable(
|
page_fillable(
|
||||||
h1("Kriminalstatistik Hamburg",
|
h1("Kriminalstatistik Hamburg",
|
||||||
style = "color: #006400;",
|
style = "color: #003063; font-weight: bold;",
|
||||||
class = "ms-4 display-4"),# ms-4 sorgt für den Abstand links
|
class = "ms-4 display-4"),# ms-4 sorgt für den Abstand links
|
||||||
navset_card_tab(
|
navset_card_tab(
|
||||||
nav_panel("Karte",
|
nav_panel("Karte",
|
||||||
@@ -121,7 +120,6 @@ ui <- function() {
|
|||||||
),
|
),
|
||||||
plotOutput("grph_top3"),
|
plotOutput("grph_top3"),
|
||||||
#tableOutput("tbl_2024"),
|
#tableOutput("tbl_2024"),
|
||||||
|
|
||||||
),
|
),
|
||||||
col_widths = c(8, 4),
|
col_widths = c(8, 4),
|
||||||
),
|
),
|
||||||
@@ -132,21 +130,59 @@ ui <- function() {
|
|||||||
choices = c("Bezirke", "Stadtteile"),
|
choices = c("Bezirke", "Stadtteile"),
|
||||||
selected = "Bezirke"
|
selected = "Bezirke"
|
||||||
),
|
),
|
||||||
###selectizeInput ist was wir wollen, wahrscheinlich
|
|
||||||
selectizeInput(
|
selectizeInput(
|
||||||
inputId = "search",
|
inputId = "search",
|
||||||
label = "Wählen Sie ein Feld (Schlüssel) aus:",
|
label = tags$span(icon("search"),"Suche"),
|
||||||
choices = NULL,
|
choices = NULL,
|
||||||
selected = NULL,
|
selected = NULL,
|
||||||
multiple = FALSE, # Hier wahrscheinlich nur Einzelauswahl gewünscht
|
multiple = FALSE, # Hier wahrscheinlich nur Einzelauswahl gewünscht
|
||||||
options = list(
|
options = list(
|
||||||
placeholder = "Start typing..."
|
placeholder = "Anfangen zu tippen...",
|
||||||
|
openOnFocus = FALSE,
|
||||||
|
allowEmptyOption = TRUE,
|
||||||
|
selectOnTab = FALSE
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
nav_panel("Vergleich", "Vergleich_inhalt"),
|
nav_panel("Vergleich",
|
||||||
|
layout_sidebar(
|
||||||
|
sidebar = sidebar(
|
||||||
|
title = "Vergleichs-Optionen",
|
||||||
|
radioButtons(
|
||||||
|
"vergleichs_modus",
|
||||||
|
"Wählen Sie den Vergleichstyp:",
|
||||||
|
choices = c(
|
||||||
|
"Straftat vs. Orte" = "ort_vergleich",
|
||||||
|
"Ort vs. Straftaten" = "straftat_vergleich"
|
||||||
|
),
|
||||||
|
selected = "ort_vergleich"
|
||||||
|
),
|
||||||
|
|
||||||
|
tags$hr(),
|
||||||
|
|
||||||
|
# 2. Dynamische Input-Felder für die Orte und Straftaten
|
||||||
|
uiOutput("vergleichs_inputs"),
|
||||||
|
|
||||||
|
# 3. Gemeinsamer Input: Das Jahr
|
||||||
|
selectizeInput(
|
||||||
|
"vergleichs_jahr",
|
||||||
|
"Jahr wählen:",
|
||||||
|
choices = c(2024, 2023),
|
||||||
|
selected = 2024
|
||||||
|
),
|
||||||
|
),
|
||||||
|
card(
|
||||||
|
card_header(uiOutput("vergleichs_titel")), # Dynamischer Titel
|
||||||
|
plotOutput("vergleichs_plot")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nav_panel("Wiki",
|
nav_panel("Wiki",
|
||||||
accordion(
|
accordion(
|
||||||
accordion_panel(
|
accordion_panel(
|
||||||
@@ -203,6 +239,7 @@ server <- function(input, output, session) {
|
|||||||
observeEvent(input$rd_maptype, {
|
observeEvent(input$rd_maptype, {
|
||||||
maptype <- input$rd_maptype
|
maptype <- input$rd_maptype
|
||||||
mapproxy <- leafletProxy("hhmap")
|
mapproxy <- leafletProxy("hhmap")
|
||||||
|
clearGroup(mapproxy, "selected")
|
||||||
|
|
||||||
if (maptype == "Bezirke"){
|
if (maptype == "Bezirke"){
|
||||||
hideGroup(mapproxy, "layer_stadtteile")
|
hideGroup(mapproxy, "layer_stadtteile")
|
||||||
@@ -224,24 +261,26 @@ server <- function(input, output, session) {
|
|||||||
prefix <- get_map_layer_prefix(clicked_polygon_id)
|
prefix <- get_map_layer_prefix(clicked_polygon_id)
|
||||||
rest_of_name <- get_map_layer_name(clicked_polygon_id)
|
rest_of_name <- get_map_layer_name(clicked_polygon_id)
|
||||||
|
|
||||||
|
selected_polygon_data <- NULL
|
||||||
if (prefix == "bez_") {
|
if (prefix == "bez_") {
|
||||||
currently_selected_bezirk(rest_of_name)
|
currently_selected_bezirk(rest_of_name)
|
||||||
currently_selected_stadtteil(paste("Bezirk", rest_of_name))
|
currently_selected_stadtteil(paste("Bezirk", rest_of_name))
|
||||||
|
selected_polygon_data <- geo_bezirke[geo_bezirke[["leaflet_id"]] == click_event$id,]
|
||||||
}
|
}
|
||||||
if(prefix == "std_") {
|
if(prefix == "std_") {
|
||||||
currently_selected_bezirk(get_bezirk_by_stadtteil(rest_of_name))
|
currently_selected_bezirk(get_bezirk_by_stadtteil(rest_of_name))
|
||||||
currently_selected_stadtteil(rest_of_name)
|
currently_selected_stadtteil(rest_of_name)
|
||||||
|
selected_polygon_data <- geo_stadtteile[geo_stadtteile[["leaflet_id"]] == click_event$id,]
|
||||||
}
|
}
|
||||||
|
req(selected_polygon_data)
|
||||||
#neues Polygon über die anderen legen, wenn ein bezirk angeklickt wurde
|
#neues Polygon über die anderen legen, wenn ein bezirk angeklickt wurde
|
||||||
leafletProxy("hhmap") %>%
|
leafletProxy("hhmap") %>%
|
||||||
clearGroup("selected") %>%
|
clearGroup("selected") %>%
|
||||||
addPolygons(
|
addPolygons(
|
||||||
data = geo_bezirke[geo_bezirke[["leaflet_id"]] == click_event$id, ],
|
data = selected_polygon_data,
|
||||||
layerId = id,
|
layerId = id,
|
||||||
fillColor = "#51968b",
|
color = "#003063",
|
||||||
color = "#7bb5ab",
|
fillOpacity = 0.2,
|
||||||
fillOpacity = 0.1,
|
|
||||||
weight = 4,
|
weight = 4,
|
||||||
group = "selected"
|
group = "selected"
|
||||||
)
|
)
|
||||||
@@ -255,10 +294,11 @@ server <- function(input, output, session) {
|
|||||||
data = geo_bezirke,
|
data = geo_bezirke,
|
||||||
layerId = ~leaflet_id,
|
layerId = ~leaflet_id,
|
||||||
group = "layer_bezirke",
|
group = "layer_bezirke",
|
||||||
color = "#7bb5ab",
|
color = "#003063",
|
||||||
fillOpacity = 0.4, # Polygon fill transparency
|
fillOpacity = 0.2, # Polygon fill transparency
|
||||||
highlightOptions = highlightOptions(
|
highlightOptions = highlightOptions(
|
||||||
color = "#103b57",
|
fillOpacity = 0.4,
|
||||||
|
color = "#003063",
|
||||||
weight = 4,
|
weight = 4,
|
||||||
bringToFront = TRUE
|
bringToFront = TRUE
|
||||||
),
|
),
|
||||||
@@ -267,13 +307,13 @@ server <- function(input, output, session) {
|
|||||||
data = geo_stadtteile,
|
data = geo_stadtteile,
|
||||||
group = "layer_stadtteile",
|
group = "layer_stadtteile",
|
||||||
layerId = ~leaflet_id,
|
layerId = ~leaflet_id,
|
||||||
color = "#7bb5ab",
|
color = "#003063",
|
||||||
fillColor = "#bdf0e7",
|
|
||||||
options = pathOptions(pane = "overlayPane"), # Use a leaflet option to ensure it's hidden
|
options = pathOptions(pane = "overlayPane"), # Use a leaflet option to ensure it's hidden
|
||||||
weight = 4,
|
weight = 3,
|
||||||
fillOpacity = 0.4, # Polygon fill transparency
|
fillOpacity = 0.2, # Polygon fill transparency
|
||||||
highlightOptions = highlightOptions(
|
highlightOptions = highlightOptions(
|
||||||
color = "#103b57",
|
fillOpacity = 0.4,
|
||||||
|
color = "#003063",
|
||||||
weight = 4,
|
weight = 4,
|
||||||
bringToFront = TRUE
|
bringToFront = TRUE
|
||||||
),
|
),
|
||||||
@@ -299,7 +339,7 @@ server <- function(input, output, session) {
|
|||||||
)
|
)
|
||||||
req(nrow(data_tibble) > 0)
|
req(nrow(data_tibble) > 0)
|
||||||
ggplot(data_tibble, aes(x = Name, y = Erfasst)) +
|
ggplot(data_tibble, aes(x = Name, y = Erfasst)) +
|
||||||
geom_col(width = 0.7, fill = "#7bb5ab") + # <-- Festlegen der Farbe direkt an allen Spalten angeknüpft nicht mehr anhand der Kategorie
|
geom_col(width = 0.7, fill = "#e10019") + # <-- Festlegen der Farbe direkt an allen Spalten angeknüpft nicht mehr anhand der Kategorie
|
||||||
geom_text(
|
geom_text(
|
||||||
# Die Text-Ästhetik soll der Wert aus der Spalte 'Erfasst' sein
|
# Die Text-Ästhetik soll der Wert aus der Spalte 'Erfasst' sein
|
||||||
aes(label = format(Erfasst, big.mark = ".", decimal.mark = ",")),
|
aes(label = format(Erfasst, big.mark = ".", decimal.mark = ",")),
|
||||||
|
|||||||
Reference in New Issue
Block a user