1

我已经检查过Shiny app is only half of browser window的帖子,并且我已经尝试了 JJ1603 的建议。我添加了

options = list(height = 1080)

但我的地图仍然在浏览器中显示半页。

我也试过

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))

但它仍然无法正常工作。

我的代码

# 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))
4

1 回答 1

4

这有效:

ui <- fluidPage(

  leafletOutput("mymap", height = "95vh")
)

感谢吉姆托德 =)

于 2018-11-05T04:11:25.113 回答