【发布时间】:2018-02-20 11:41:24
【问题描述】:
我正在开发一个带有 7 或 8 个 valueBox 的测试 ShinyApp。一切正常,除了闪亮的每行添加三个 valueBox 。现在我在顶部有三行显示这 7 个 valueBox。我尝试更改宽度参数,但它不起作用。这是我下面的代码。
我的目标是每行有 5 个 valueBox 而不是默认的三个。非常感谢任何建议。
## Only run this example in interactive R sessions
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Dynamic boxes"),
dashboardSidebar(),
dashboardBody(
fluidRow(
valueBoxOutput("vbox1"),
valueBoxOutput("vbox2"),
valueBoxOutput("vbox3"),
valueBoxOutput("vbox4"),
valueBoxOutput("vbox5"),
valueBoxOutput("vbox6"),
valueBoxOutput("vbox7"),
valueBoxOutput("vbox8")
)
)
)
server <- function(input, output) {
output$vbox1 <- renderValueBox({ valueBox( "One","Yes", width = 2, icon = icon("stethoscope"))})
output$vbox2 <- renderValueBox({ valueBox( "Two","Yes", width = 2, icon = icon("stethoscope"))})
output$vbox3 <- renderValueBox({ valueBox( "Skip","Yes", width = 2, icon = icon("stethoscope"))})
output$vbox4 <- renderValueBox({ valueBox( "a Two","Yes", width = 2, icon = icon("stethoscope"))})
output$vbox5 <- renderValueBox({ valueBox( "Then","Yes", width = 2, icon = icon("stethoscope"))})
output$vbox6 <- renderValueBox({ valueBox( "some","Yes", width = 2, icon = icon("stethoscope"))})
output$vbox7 <- renderValueBox({ valueBox( "a hundred too","Yes", width = 2, icon = icon("stethoscope"))})
}
shinyApp(ui, server)
【问题讨论】:
-
也许使用
columns(),见example here
标签: r shiny shinydashboard flexdashboard