首页 > 解决方案 > R Shiny ValueBox 和表格布局

问题描述

我正在 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)
                   )
          )

  )

当前布局与行间距:

当前布局

标签: rshinyshinydashboard

解决方案


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

   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"
                   )

所需布局:

所需布局


推荐阅读