Search code examples
rshinyr-leaflet

R shiny app only half page in browser is showing


I have checked the post Shiny app is only half of browser window and I've tried JJ1603's suggestion. I added

options = list(height = 1080)

but my map is still showing half page in browser.

I've also tried

library("htmlwidgets")

window_height <- JS('window.innerHeight')
window_width <- JS('window.innerWidth')

# Run the application 
shinyApp(ui = ui, server = server, options = list(height = window_height, width = window_width))

but it's still not working.

my code

# Define UI for application
ui <- fluidPage(     
  leafletOutput("mymap")
)

# Define server
server <- function(input, output) {     
  data <- read.csv("dat.csv")    
  })


  output$mymap <- renderLeaflet({
    leaflet(data) %>%           
      addProviderTiles("Esri.WorldImagery") %>%          
      addCircleMarkers(lng = ~ long, 
                       lat= ~ lat, 
                       color = "#00d4ff", 
                       radius = factor(data$freq),
                       label = lapply(labs, HTML),
                       clusterOptions = markerClusterOptions()
      )
  })
}
# Run the application 
# shinyApp(ui, server)
shinyApp(ui = ui, server = server, options = list(height = window_height, width = window_width))

Solution

  • This worked:

    ui <- fluidPage(  
      leafletOutput("mymap", height = "95vh")
    )