Add Sidebar and table with mock data
This commit is contained in:
@@ -3,9 +3,11 @@ library(shiny)
|
||||
library(bslib)
|
||||
library(leaflet)
|
||||
library(sf)
|
||||
library(htmltools)
|
||||
|
||||
|
||||
crime_json <- fromJSON(file="data.json")
|
||||
#View(crime_json)
|
||||
|
||||
geo_bezirke <- st_read("geobezirke-parsed.json")
|
||||
geo_bezirke <- st_transform(geo_bezirke, crs = 4326)
|
||||
@@ -15,12 +17,22 @@ geo_bezirke$leaflet_id <- paste("bez_", geo_bezirke$bezirk, sep="")
|
||||
geo_stadtteile <- st_read("geostadtteile-parsed.json")
|
||||
geo_stadtteile <- st_transform(geo_stadtteile, crs = 4326)
|
||||
geo_stadtteile$leaflet_id <- paste("std_", geo_stadtteile$stadtteil, sep="")
|
||||
|
||||
bezirke <- names(crime_json)
|
||||
|
||||
ui <- page_fillable(
|
||||
layout_columns(
|
||||
card(
|
||||
page_sidebar(
|
||||
layout_columns(
|
||||
leafletOutput("hhmap"),
|
||||
card(
|
||||
textOutput("txt_map_selection"),
|
||||
"2024",
|
||||
tableOutput("tbl_2024"),
|
||||
"2023",
|
||||
tableOutput("tbl_2023"),
|
||||
),
|
||||
col_widths = c(9, 3),
|
||||
),
|
||||
sidebar = sidebar(
|
||||
radioButtons(
|
||||
inputId = "rd_maptype",
|
||||
label = "Kartentyp",
|
||||
@@ -30,18 +42,14 @@ ui <- page_fillable(
|
||||
selectInput(
|
||||
inputId = "drp_bezirk",
|
||||
label = "Bezirk",
|
||||
choices = bezirke),
|
||||
choices = bezirke
|
||||
),
|
||||
selectInput(
|
||||
inputId = "drp_stadtteil",
|
||||
label = "Stadtteil",
|
||||
choices = NULL,
|
||||
)
|
||||
),
|
||||
),
|
||||
leafletOutput("hhmap"),
|
||||
card(
|
||||
textOutput("txt_map_selection")
|
||||
),
|
||||
col_widths = c(3, 6, 3)
|
||||
)
|
||||
)
|
||||
server <- function(input, output, session){
|
||||
@@ -133,6 +141,20 @@ server <- function(input, output, session){
|
||||
zoom = 11
|
||||
)
|
||||
})
|
||||
|
||||
Names = c("Raub", "Diebstahl", "BtMG")
|
||||
Faelle = c(1234, 5678, 9000)
|
||||
Aufgeklaert = c(687867, 768789, 658)
|
||||
Relativ = c("15%", "70%", "69%")
|
||||
fake_data <- data.frame(
|
||||
Name = Names,
|
||||
Faelle = Faelle,
|
||||
Aufgeklärt = Aufgeklaert,
|
||||
Relativ = Relativ,
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
output$tbl_2024 <- renderTable(fake_data, striped = TRUE)
|
||||
output$tbl_2023 <- renderTable(fake_data, striped = TRUE)
|
||||
}
|
||||
options(shiny.host = '0.0.0.0')
|
||||
options(shiny.port = 8888)
|
||||
|
||||
Reference in New Issue
Block a user