Sun*_*ear 3 r shiny shinydashboard flexdashboard
我正在开发具有7或8 valueBox的测试ShinyApp。一切正常,除了,闪亮的每行添加三个valueBox。现在,我在顶部有三行显示这7个valueBox。我尝试更改width参数,但它不起作用。这是我的下面的代码。
我的目标是每行有5个valueBox而不是默认的3个。任何建议深表感谢。
## 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)
Run Code Online (Sandbox Code Playgroud)
我们可以设置width在valueBoxOutput
ui <- dashboardPage(
dashboardHeader(title = "Dynamic boxes"),
dashboardSidebar(),
dashboardBody(
fluidRow(
valueBoxOutput("vbox1", width = 2),
valueBoxOutput("vbox2", width = 2),
valueBoxOutput("vbox3", width = 2),
valueBoxOutput("vbox4", width = 2),
valueBoxOutput("vbox5", width = 2)),
fluidRow(
valueBoxOutput("vbox6", width = 2),
valueBoxOutput("vbox7", width = 2),
valueBoxOutput("vbox8", width = 2)
)
)
)
Run Code Online (Sandbox Code Playgroud)
-输出