From 7936fb61c21f530bb2108dc829b217edf8546d2c Mon Sep 17 00:00:00 2001 From: fvitalini Date: Wed, 25 Mar 2020 17:54:44 +0100 Subject: [PATCH 1/2] fix addPolygons #45 --- R/mod_map.R | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/R/mod_map.R b/R/mod_map.R index d63eaca8..4cd268be 100644 --- a/R/mod_map.R +++ b/R/mod_map.R @@ -14,7 +14,7 @@ mod_map_ui <- function(id){ div( style = "position: relative;", # Height needs to be in pixels. Ref https://stackoverflow.com/questions/39085719/shiny-leaflet-map-not-rendering - withSpinner(leafletOutput(ns("map"), width = "100%", height = "800")), + withSpinner(div(leafletOutput(ns("map"), width = "100%", height = "800"), style = "max-height: 95vh")), absolutePanel( id = ns("input_date_control"), class = "panel panel-default", top = 10, left = 10, draggable = F, @@ -77,15 +77,16 @@ mod_map_server <- function(input, output, session, data){ data_selected <- data_date() %>% bind_cols(data_date()[,input$radio_choices] %>% setNames("indicator")) %>% - select(country_name, indicator) %>% - filter(indicator >= 1) + select(country_name, indicator) data_plot <- sp::merge(countries_data, - data_selected, all.x = FALSE, + data_selected, by.x = "NAME", by.y = "country_name", sort = FALSE) + data_plot[["indicator"]] <- replace_na(data_plot[["indicator"]], 0) + data_plot }) @@ -110,13 +111,13 @@ mod_map_server <- function(input, output, session, data){ pal2 <- reactive({ # colorBin(palette = c("#FFFFFFFF",rev(viridis::inferno(256))), domain = c(0,roundUp(max_value())), na.color = "#f2f5f3", bins = 20) if (input$radio_choices == "confirmed") { - colorNumeric(palette = "Reds", domain = domain(), na.color = "#f2f5f3") + colorNumeric(palette = "Reds", domain = domain(), na.color = "white") } else if (input$radio_choices == "deaths") { - colorNumeric(palette = "Greys", domain = domain(), na.color = "#f2f5f3") + colorNumeric(palette = "Greys", domain = domain(), na.color = "white") } else if (input$radio_choices == "active") { - colorNumeric(palette = "Blues", domain = domain(), na.color = "#f2f5f3") + colorNumeric(palette = "Blues", domain = domain(), na.color = "white") } else if (input$radio_choices == "recovered") { - colorNumeric(palette = "Greens", domain = domain(), na.color = "#f2f5f3") + colorNumeric(palette = "Greens", domain = domain(), na.color = "white") } }) From 9acbefe30768e7d4e3a9b645b7a3256846dfbaa5 Mon Sep 17 00:00:00 2001 From: fvitalini Date: Wed, 25 Mar 2020 18:12:37 +0100 Subject: [PATCH 2/2] fix map height #45 --- R/mod_map.R | 2 +- inst/app/www/style.css | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/R/mod_map.R b/R/mod_map.R index 4cd268be..e1114be9 100644 --- a/R/mod_map.R +++ b/R/mod_map.R @@ -14,7 +14,7 @@ mod_map_ui <- function(id){ div( style = "position: relative;", # Height needs to be in pixels. Ref https://stackoverflow.com/questions/39085719/shiny-leaflet-map-not-rendering - withSpinner(div(leafletOutput(ns("map"), width = "100%", height = "800"), style = "max-height: 95vh")), + withSpinner(leafletOutput(ns("map"), width = "100%", height = "800")), absolutePanel( id = ns("input_date_control"), class = "panel panel-default", top = 10, left = 10, draggable = F, diff --git a/inst/app/www/style.css b/inst/app/www/style.css index 416ac8f0..2d883c27 100644 --- a/inst/app/www/style.css +++ b/inst/app/www/style.css @@ -81,7 +81,6 @@ body { } - .modal-body p { margin: 0; } @@ -95,6 +94,10 @@ body { vertical-align: baseline !important; } +#global-map_ui-map{ + max-height: 95vh; +} + h5 { font-family: inherit; font-size: 12px;