如何将输出并排放在闪亮的?

时间:2016-11-05 12:43:49

标签: r shiny

如何并排排列输出?我尝试使用fluidRow列,但它不起作用(第二个表出现在第一个内部)。

这是我的应用的图片。 enter image description here

和标签代码:

          tabPanel("Wavelet Coefficients", htmlOutput("tmod1"),
                   tableOutput("wsf"), tableOutput("wbf"), htmlOutput("tmod2"),
                   tableOutput("vsf"), tableOutput("vbf")),

提前谢谢

1 个答案:

答案 0 :(得分:8)

布局的详细概述如下:RStudio: Application layout guide

基本上您需要的是使用shiny::fluidRow()定义一行,然后使用shiny::column()将其划分为多个列。 在Bootstrap约定之后,总宽度等于12。

看一下你的例子,我试着将它拆分为7/5,但你需要校准布局。

您的代码应更改如下:

tabPanel("Wavelet Coefficients", 
  fluidRow(htmlOutput("tmod1")), # Header, I presume ?
  fluidRow(
    column(width = 7, tableOutput("wsf")),
    column(width = 5, tableOutput("wbf"))),
  fluidRow(htmlOutput("tmod2")), # Header #2, I presume ?
    column(width = 7, tableOutput("vsf")),
    column(width = 5, tableOutput("vbf"))
)

`

以下是工作示例中的代码,可在此处找到:https://github.com/Gnolam/stackoverflow-examples/tree/master/Shiny-2-columns

tabPanel(
  "2 columns",
  fluidRow(
    column(width = 4,
           h2("Column #1"),
           plotOutput("distPlot")),
    column(width = 8,
           h2("Column #2"),
           DT::dataTableOutput('tbl'))
  ))

如果有帮助请告诉我