ShinyDashboard-在同一行上显示3个以上的信息框

ShinyDashboard-在同一行上显示3个以上的信息框,r,shiny,shinydashboard,R,Shiny,Shinydashboard,我想在同一行中显示4个信息框(或值框,我真的不在乎),但它似乎不起作用 这是一个工作的简化版本的代码,基于Rstudio wesite上的shinydashbaord教程(我的使用infoBoxOutputs,但我想这里的格式并不重要): ui在fluidRow中,我们知道它的最大列宽为12 查看infoxBox功能: infoBox(title, value = NULL, subtitle = NULL, icon = shiny::icon("bar-chart"), color =

我想在同一行中显示4个信息框(或值框,我真的不在乎),但它似乎不起作用

这是一个工作的简化版本的代码,基于Rstudio wesite上的shinydashbaord教程(我的使用infoBoxOutputs,但我想这里的格式并不重要):


ui在
fluidRow
中,我们知道它的最大列宽为12

查看
infoxBox
功能:

infoBox(title, value = NULL, subtitle = NULL,
  icon = shiny::icon("bar-chart"), color = "aqua", width = 4,
  href = NULL, fill = FALSE)
}
我们看到宽度的设置是
width=4

要在一行上安装所需的4个信息框,只需设置
width=3


所有意图和目的的明确示例:

library(shiny)
library(shinydashboard)

server <- function(input, output) {
}

ui <- fluidPage(
  fluidRow(
    infoBox("test", value=1, width=3),
    infoBox("test", value=2, width=3),
    infoBox("test", value=3, width=3),
    infoBox("test", value=4, width=3)
  )
)

shinyApp(ui = ui, server = server)
库(闪亮)
图书馆(shinydashboard)

服务器显然这就是我要找的:

在server.R中: 设置宽度为3的值框:

output$infoBox1 <- renderValueBox({..., valueBox(...,width = 3)})
库(闪亮)
图书馆(shinydashboard)

服务器你试过“宽度”参数吗?
infoBox(“1”,10*2,icon=icon(“信用卡”),width=3)
试一下如果我的答案有效-你能接受吗?我以前已经试过了(忘了在帖子中提到),现在又试了一次-它不起作用。。。每行仍显示3个框。@KeshetE请在我添加的编辑中尝试我的示例。这就是你想要的吗?对我来说还是不行。在服务器端构建infoBox时可能会有所不同?非常好的解释。根据您的说明,了解如何在同一行上安装3个
box()
组件。非常感谢。
library(shiny)
library(shinydashboard)

server <- function(input, output) {
}

ui <- fluidPage(
  fluidRow(
    infoBox("test", value=1, width=3),
    infoBox("test", value=2, width=3),
    infoBox("test", value=3, width=3),
    infoBox("test", value=4, width=3)
  )
)

shinyApp(ui = ui, server = server)
output$infoBox1 <- renderValueBox({..., valueBox(...,width = 3)})
column( 3,valueBoxOutput("infoBox1", width = 12))
library(shiny)
library(shinydashboard)

server <- function(input, output) {
}

ui <- fluidPage(
  fluidPage(                      ##Change for fluidPage
     mainPanel(width = 12,        ##HERE 
      infoBox("test", value=1, width=3),
      infoBox("test", value=2, width=3),
      infoBox("test", value=3, width=3),
      infoBox("test", value=4, width=3)
  )
)

shinyApp(ui = ui, server = server)