Skip to content

Commit 10a32d7

Browse files
committed
add centres checkbox to rehab map
1 parent 4733928 commit 10a32d7

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

server.R

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,24 +280,37 @@ function(input, output, session) {
280280
rvs$map_rehab
281281
})
282282

283-
observeEvent(list(input$rehab_layer_selection, input$rehab_towns_checkbox), {
283+
observeEvent(list(input$rehab_layer_selection, input$rehab_markers_checkbox), {
284284
rehab_base_groups <- c("None", names(rehab_tiers))
285285
rehab_towns_groups <- paste0("towns_", rehab_base_groups)
286+
rehab_centre_groups <- paste0("centres_", names(rehab_tiers))
286287

287288
hide_base_groups <- rehab_base_groups[rehab_base_groups != input$rehab_layer_selection]
288289
show_base_group <- input$rehab_layer_selection
289290

290291
hide_centre_groups <- paste0("centres_", hide_base_groups)
291292
show_centre_group <- paste0("centres_", show_base_group)
292293

293-
if(is.null(input$rehab_towns_checkbox)) {
294+
if(!"Towns" %in% input$rehab_markers_checkbox) {
294295
show_towns_group <- c()
295296
hide_towns_groups <- rehab_towns_groups
296297
} else {
297298
show_towns_group <- rehab_towns_groups[which(rehab_base_groups == show_base_group)]
298299
hide_towns_groups <- rehab_towns_groups[rehab_towns_groups != show_towns_group]
299300
}
300301

302+
if(!"Centres" %in% input$rehab_markers_checkbox) {
303+
show_centre_group <- c()
304+
hide_centre_groups <- rehab_centre_groups
305+
} else {
306+
if(show_base_group=="None") {
307+
show_centre_group <- c()
308+
} else {
309+
show_centre_group <- rehab_centre_groups[which(names(rehab_tiers) == show_base_group)]
310+
}
311+
hide_centre_groups <- rehab_centre_groups[!rehab_centre_groups %in% show_centre_group]
312+
}
313+
301314
show_ids <- c(show_base_group, show_centre_group, show_towns_group)
302315
hide_ids <- c(hide_base_groups, hide_centre_groups, hide_towns_groups)
303316

ui.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ navbarPage(
118118
),
119119
tags$hr(),
120120
checkboxGroupInput(
121-
"rehab_towns_checkbox",label=NULL,
122-
choices="Towns",
123-
selected="Towns"
121+
"rehab_markers_checkbox",label=NULL,
122+
choices=c("Towns", "Centres"),
123+
selected=c("Towns", "Centres")
124124
)
125125
),
126126
tags$div(

0 commit comments

Comments
 (0)