Reputation: 168
I have a pivottable generated from rpivotTable library.I am using shiny dashboard to show the output of the pivottable in a box. The fit doesn't seem to be right.
Below is the screenshot of how the output looks like.
I tried to get the box size to match the pivottable size and have a scroll bar if the size of the pivottable is more. But the background color, "skin-blue", doesn't seem to be fitting according to the size of the box.
below is a sample code:
ui.R
library(shiny)
library(shinydashboard)
library(rpivotTable)
header <- dashboardHeader(title="Dashboard")
sidebar <- dashboardSidebar(
menuItem("Menu1",icon = icon("dashboard"),
menuSubItem("Sub1", icon = icon("dashboard")),
menuSubItem("Sub2", icon = icon("dashboard")),
menuSubItem("Sub3", icon = icon("dashboard"))
),
menuItem("Menu2",icon = icon("dashboard"),
menuSubItem("Sub12", icon = icon("dashboard")),
menuSubItem("Sub22", icon = icon("dashboard")),
menuSubItem("Sub32", icon = icon("dashboard"))))
body <- dashboardBody(
tabItem(tab = "sub1",
box(width = 12,selectInput("testip",label = "Input",choices = c("A","B","C")),
selectInput("testip1",label = "Input",choices = c("A","B","C")),
selectInput("testip2",label = "Input",choices = c("A","B","C")),
actionButton("submit","Submit")),
box(width = 12,height = "800px",
tags$head(tags$style( type = 'text/css', '#myPivot{ overflow-x: scroll; overflow-y: scroll; }')),
rpivotTableOutput("myPivot", height = "780px")))
)
dashboardPage(header, sidebar, body)
server.R
server <- function(input, output) {
output$myPivot <- renderRpivotTable(rpivotTable(data = mtcars, rows = "mpg", cols = "disp"))
}
Upvotes: 1
Views: 3291
Reputation: 21
Try removing heights at ui
tags$head(tags$style(type = 'text/css', '#Alert{ overflow-x: scroll; }')),
rpivotTableOutput("myPivot"))
Then at server, define heights
output$myPivot <- renderRpivotTable(rpivotTable(data = mtcars, rows = "mpg", cols = "disp", height = "780px"))
This works for me.
Upvotes: 2