我使用shinyDashboard
创建了一个信息中心,我有一张leaflet
的地图。 shinyDashboard中使用的box
元素为地图创建了400px的固定高度。
我希望地图为90vh
,以便覆盖大部分屏幕,因此我在UI
文件中写了这个:
tabItem(tabName = "widgets",
fluidPage(
fluidRow(
tags$head(tags$style(type = "text/css",'
#geomap {
height: 90vh;
}
')),
box(title = "Geographical distribution",
leafletOutput("geomap")
)
)
)
)
现在,当我检查页面时,我可以看到该属性已传递到#geomap
id,但由于某种原因被覆盖
此外,这是节点
我在成功之前已经覆盖了类,所以我不明白如何不能覆盖ID。有什么想法吗?
谢谢!
编辑:这是一个示例代码:
library(shiny)
library(shinydashboard)
library(leaflet)
server <- function(input, output, session) {
output$geomap <- renderLeaflet({
m <- leaflet(data) %>%
addProviderTiles("CartoDB.Positron")
})
}
ui <- dashboardPage(skin = "black",
dashboardHeader(title = "Test"),
dashboardSidebar(
sidebarMenu(
menuItem("Map distribution", tabName = "widgets", icon = icon("th"))
)
),
dashboardBody(
tabItems(
tabItem(tabName = "widgets",
fluidPage(
fluidRow(
tags$head(tags$style(HTML('
.col-sm-6 {
width: 100%;
}
'))),
box(title = "Geographical distribution",
leafletOutput("geomap")
)
)
)
)
)
)
)
shinyApp(ui, server)