R闪亮的ValueBox和表格布局

问题描述 投票:0回答:2

我正在R Shiny中构建一个UI,并在布局部分苦苦挣扎。我想一起绘制ValueBoxes和Table。以下是当前输出,但各行之间存在间隙。因此,您能否建议可以采取哪些措施来消除此差距并获得所需的布局。这是代码

  tabItem("overall_current_performance",

          fluidRow(

            column(width = 12,
                   valueBoxOutput("vlue", width = 3),
                   valueBoxOutput("vlue1", width = 3),
                   valueBoxOutput("win_loose", width = 3),
                   box(
                     title = "Box title", width = 3, 
                     div(style = "height:200px"), status = "primary",
                     "Box content"
                   )
                   ),

            column(width = 12,
                   valueBoxOutput("performance", width = 3),
                   valueBoxOutput("performance1", width = 3),
                   valueBoxOutput("win_loose1", width = 3)
                   )
          )

  )

Current Layout with row gap

r shiny shinydashboard
2个回答
0
投票

尝试用四列组织布局。

tabItem("overall_current_performance",

        fluidRow(
          column(
            width = 3,
            valueBoxOutput("vlue"),
            valueBoxOutput("performance")
          ),
          column(
            width = 3,
            valueBoxOutput("vlue1"),
            valueBoxOutput("performance1")
          ),
          column(
            width = 3,
            valueBoxOutput("win_loose"),
            valueBoxOutput("win_loose1")
          ),
          column(
            width = 3,
            box(
              title = "Box title", 
              div(style = "height:200px"), status = "primary",
              "Box content"
            )
          )
)

0
投票

以下更改给出了正确的布局,

   column(
      width = 3,
             valueBoxOutput(
                    "vlue", width = NULL
                   ),
                   valueBoxOutput(
                    "vlue1", width = NULL
                   )
            ),

            column(width = 3,
                   valueBoxOutput(
                     "performance", width = NULL
                   ),
                   valueBoxOutput(
                     "performance1", width = NULL
                   )
            ),

            column(width = 3,
                   valueBoxOutput(
                     "win_loose", width = NULL
                   ),
                   valueBoxOutput(
                     "win_loose1", width = NULL
                   )
            ),

            column(width = 3,
                   box(
                     title = "Box title", width = NULL, div(style = "height:150px"), 
                     status = "primary","Box content"
                   )

Desired Layout

© www.soinside.com 2019 - 2024. All rights reserved.