简体   繁体   中英

rpivotTable not fitting in my Shiny Dashboard page

I am using rpivoTable package in my shiny dashboard. The problem is that my tables has close to 25 variables (columns) whereas I am only able to view 10 columns. Rest are out of view and there's no slider also to view them.

Best,

I find one way -- add css to that pivot

tags$head(tags$style( type = 'text/css',  '#pivot{ overflow-x: scroll; }')),
          rpivotTableOutput('pivot', width = "100%", height = "500px")

for example

UI

library(shiny)
library(rpivotTable)
library(shinydashboard)
shinyUI(dashboardPage(
  dashboardHeader(title = "example"),
  dashboardSidebar(disable = T),
  dashboardBody(

      tags$head(tags$style( type = 'text/css',  '#pivot{ overflow-x: scroll; }')),
      rpivotTableOutput('pivot', width = "100%", height = "500px")
  )

))

server

df=data.frame(lapply(1:25,function(i)i=rnorm(20)))
colnames(df)=as.character(letters[1:25])

shinyServer(function(input, output,session) {

  output$pivot <- renderRpivotTable({
    rpivotTable(data = df)
  })


})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM