2016-06-30 5 views
1

私はピボットテーブルをrpivotTableライブラリから生成しました。光沢のあるダッシュボードを使用してピボットボックスの出力をボックスに表示しています。フィット感は正しいとは思わない。シャイニーダッシュボードrpivotTableレイアウト

以下は、出力の様子のスクリーンショットです。

enter image description here

私はボックスのサイズは、ピボットテーブルのサイズに一致すると、ピボットテーブルのサイズが多い場合、スクロールバーを持って取得しようとしました。しかし、背景色「肌色」は、箱の大きさに合わせてフィットしていないようです。

は、以下のサンプルコードである:

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

} 

答えて

2

UI

サーバに続い
tags$head(tags$style(type = 'text/css', '#Alert{ overflow-x: scroll; }')), 
rpivotTableOutput("myPivot")) 

で高さを除去してみてください、高さを定義する

output$myPivot <- renderRpivotTable(rpivotTable(data = mtcars, rows = "mpg", cols = "disp", height = "780px")) 

これは私に役立ちます。

関連する問題