【问题标题】:Reduce space between FluidRow减少 FluidRow 之间的空间
【发布时间】:2020-11-15 13:14:35
【问题描述】:

我正在尝试以闪亮的方式创建特定的布局,并且我坚持减少 tab1 和 tab5 之间的空间:

下面的代码显示了我尝试过的几件事:

body <- dashboardBody(
  fluidRow(
    tabBox(
      height = "300px",
      tabPanel("tab1")
    ),
    tabBox(
      height = "600px",
      tabPanel("tab2"),
      tabPanel("tab3"),
      tabPanel("tab4")
    )
  ),
  fluidRow(
    tabBox(
      height = "300px",
      tabPanel("tab5")
    )
  )
)

shinyApp(
  ui = dashboardPage(
    dashboardHeader(title = "example"),
    dashboardSidebar(),
    body
  ),
  server = function(input, output) {
    
  }
)

我们将不胜感激

【问题讨论】:

    标签: r layout shiny shinydashboard


    【解决方案1】:

    也许你正在寻找这个。有关fillRow() fillCol()的更多详细信息,请参阅here

    ui <- fillPage(
      fillRow( #flex=c(1,1),
        fillCol(
          div(shinydashboard::tabBox(
            height = "300px", width="100%",
            tabPanel("tab1", plotOutput("plotTopLeft", height = "300px"))
          )),
          div(shinydashboard::tabBox(
            height = "300px", width="100%",
            tabPanel("tab5", plotOutput("plotBottomLeft", height = "300px"))
          ))
        ),
        fillCol(
          shinydashboard::tabBox(
            height = "600px", width="100%",
            tabPanel("tab2", plotOutput("plotRight", height = "550px")),
            tabPanel("tab3"),
            tabPanel("tab4")
          )
        )
      )
    
    )
    
    server <- function(input, output) {
      output$plotTopLeft <- renderPlot(plot(cars))
      output$plotRight <- renderPlot(plot(pressure))
      output$plotBottomLeft <- renderPlot(plot(AirPassengers))
    }
    
    shinyApp(ui = ui, server = server)
    

    【讨论】: