使用列时格式化在闪亮的应用程序上丢失

时间:2017-05-10 12:21:55

标签: r shiny

我有一个闪亮的仪表板,我正在使用选项卡面板,在该面板中我试图并排放置两个汇总表

这些表似乎失去了tabPanel的背景

有谁知道为什么

下面的可重复示例

library(shiny)
library(shinydashboard)
library(dplyr)
data(iris)

server <- function(input, output) {

  output$top_Length = renderTable({

    mydf <-  iris %>%
      arrange(desc(Sepal.Length)) %>% 
      slice(1:10)


    mydf

  })  

  output$top_width = renderTable({

    mydf <-  iris %>%
      arrange(desc(Sepal.Width)) %>% 
      slice(1:10)

  })  

   }


header <- dashboardHeader(title = "Flower Power")

sidebar <- dashboardSidebar(disable = TRUE)

 body <- dashboardBody(fluidRow(

  tabBox(title = "Charting Information",width = 9,
     tabPanel("Trending"),
     tabPanel("Details",
              column(4,
                     h2('Top Sepal Length'),
                     tableOutput('top_Length')
              ),

              column(3,
                     h2('Top Sepal Width'),
                     tableOutput('top_width')    
              )

     )
     )
))

ui <- dashboardPage(
  skin = "yellow",
  header,
  sidebar,
  body
)  


shinyApp(ui = ui, server = server)

1 个答案:

答案 0 :(得分:1)

使用fluidRow防止重叠,如下所示:

            fluidRow(  column(4,
                     h2('Top Sepal Length'),
                     tableOutput('top_Length',width="200")
              ),

                 column(3,
                     h2('Top Sepal Width'),
                     tableOutput('top_width')  )  
              )