【发布时间】:2020-04-12 14:07:41
【问题描述】:
我试图让两个闪亮的 InfoBox 并排放置,在它们之间占据流动行内的整个宽度。为此,我指定宽度 = 6,即引导程序 12 的一半。
但是,width 参数对以 col-sm-4 (#shiny-html-output col-sm-4) 出现的 Div 类没有影响。结果,这两个盒子占据了 2/3 和(4+4 的十二分之一)。
作为一个附带问题,我还希望能够直接指定肤色,而不仅仅是黄色,这是我从可用肤色中最接近橙色的颜色。我怀疑我需要用 CSS 覆盖。
library(shiny)
library(shinydashboard)
dashboard_colour <- "orange"
sidebar <- dashboardSidebar(
sidebarMenu(
menuItem("Overview", tabName = "overview", icon = icon("dashboard"))
)
)
body <- dashboardBody(
tabItems(
tabItem(tabName = "overview",
h2("Overview"),
fluidRow(
infoBoxOutput("boxLeft"),
infoBoxOutput("boxRight")
)
)
)
)
ui <- dashboardPage(
skin = "yellow",
dashboardHeader(title = "Orange Dashboard"),
sidebar,
body
)
server <- function(input, output) {
output$boxLeft <- renderValueBox({
infoBox(
123, "No on Left",
icon = icon("arrow-alt-circle-left", class = "infoIcon"),
color = dashboard_colour,
width = 6
)
})
output$boxRight <- renderValueBox({
infoBox(
456, "No on Right",
icon = icon("arrow-alt-circle-right", class = "infoIcon"),
color = dashboard_colour,
width = 6
)
})
}
# Run the application
shinyApp(ui = ui, server = server)
【问题讨论】: