rpivotTable not fitting in my Shiny Dashboard page

感情迁移 提交于 2019-12-24 00:52:48

问题


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,


回答1:


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


})


来源:https://stackoverflow.com/questions/33951837/rpivottable-not-fitting-in-my-shiny-dashboard-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!