首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >框()的shinydashboard列布局

框()的shinydashboard列布局
EN

Stack Overflow用户
提问于 2019-05-22 12:00:58
回答 1查看 1.6K关注 0票数 0

我有一个如下所示的shinydashboard:

代码语言:javascript
复制
# Packages
library(shinydashboard)
library(tidyverse)
library(readxl)
library(scales)
theme_set(theme_light())


header <- dashboardHeader(
  title = "Test App",
  titleWidth = 215
)

sidebar <- dashboardSidebar(
  sidebarMenu(
    menuItem("Test Tab", tabName = "test_tab",
             icon = icon("paper-plane"), startExpanded = TRUE)
  )
)


body <- dashboardBody(
  tabItems(
    tabItem(tabName = "test_tab",

            fluidRow(
              column(width = 4,
                     h2("Column X"),
                     valueBoxOutput("first_value", width = NULL),
                     box(flexdashboard::gaugeOutput("second_value", width = "90%", height = "100px"),
                         title = "Second Value", status = "primary", solidHeader = TRUE,
                         collapsible = FALSE, width = NULL
                     )
              ),
              column(width = 8,
                     h2("Column Y"),

                     box(
                       title = "#3", status = "primary", solidHeader = TRUE,
                       collapsible = FALSE, width = 4
                     ),
                     box(
                       title = "#4", status = "primary", solidHeader = TRUE,
                       collapsible = FALSE, width = 4
                     )
              )
            ),

            fluidRow(
              h2("Row A"),

              column(width = 12,

                     box(title = "Third Value", status = "primary", solidHeader = TRUE,
                         width = 2.4),

                     box("Fourth Value", status = "primary", solidHeader = TRUE,
                         width = 2.4),

                     box("Fifth Value", status = "primary", solidHeader = TRUE,
                         width = 2.4),


                     box("Sixth Value", status = "primary", solidHeader = TRUE,
                         width = 2.4),


                     box("Seventh Value", status = "primary", solidHeader = TRUE,
                         width = 2.4)
              )


            )

    )
  )
)


# Put them together into a dashboardPage
ui <- dashboardPage(skin = "blue", header = header,
                    sidebar = sidebar,
                    body = body)


server <- function(input, output) {

  output$first_value <- renderValueBox({

    valueBox(
      comma_format()(100000),
      subtitle = "First Value",
      icon = icon("list"), color = "purple"
    )
  })

  output$second_value = flexdashboard::renderGauge({
    flexdashboard::gauge(0.12 * 100,
                         symbol = '%',
                         min = 0, 
                         max = 100)
  })

}

shinyApp(ui, server)

我正在尝试让RowA下面的框()以五列的格式排列,如下所示:

Third Value | Fourth Value | Fifth Value | Sixth Value

我不确定在这里我该怎么做。我试着在fluidRow()中的column()中放置了5个框,但不幸的是,框总是水平显示……

有没有办法以列的形式显示这些框?如果没有,你能指导我使用与我的功能相似的其他功能吗?

EN

回答 1

Stack Overflow用户

发布于 2019-05-22 17:56:04

您已经将这五个框中每个框的列宽指定为2.4 (我猜是12/5)。

列宽应为整数。如果你用2.4代替2,它就会工作得很好。

请注意,您将在框5的右侧有一个空列,对应于剩余的2 (12 - 2*5)个位置。

这是基于引导列布局的。有关详细信息,请参阅this教程。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56249127

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档