【问题标题】:R shiny app only half page in browser is showingR闪亮的应用程序仅显示浏览器中的半页
【发布时间】:2018-11-05 12:11:25
【问题描述】:

我查看了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))

【问题讨论】:

  • 设置leafletOutput的宽度。传单输出(“我的地图”,宽度 =“100”)。试试看。
  • 哦,它使地图宽度非常小:/但您的建议直接让我得到了答案。我使用高度而不是重量:leafletOutput("mymap", height = "95vh") 非常感谢 Jim =)

标签: r shiny leaflet


【解决方案1】:

这行得通:

ui <- fluidPage(

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

感谢吉姆·托德 =)

【讨论】:

  • 不错的一个!谢谢!!
猜你喜欢
  • 2016-11-03
  • 2014-01-07
  • 2013-07-04
  • 2017-03-03
  • 1970-01-01
  • 2018-07-14
  • 1970-01-01
  • 2019-03-23
  • 1970-01-01
相关资源
最近更新 更多