2016-11-05 93 views
0

如何將我的輸出並排排列?我嘗試了FluidRow列,但它不起作用(第二個表格出現在第一個表格內)。如何將輸出並排閃亮?

這是我的應用程序的圖像。 enter image description here

和標籤代碼:

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

預先感謝您

+1

'fluidRow'與'column'組合應該可以工作。你能發佈沒有用的代碼嗎? –

回答

4

佈局的詳細介紹是在這裏: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')) 
)) 

請讓我知道它是否有幫助

+0

對不起,我遲到的迴應。你的代碼完美無瑕!奇怪的是,我的表是重疊的,因爲我寫了'htmlOutput(「tmod1」)'而不是'fluidRow(htmlOutput(「tmod1」))'' –