2017-09-16 1 views
2

이것은 내 previous question의 확장입니다. 이제는 내 메인 패널의 높이를 확장 할 수 없습니다.광택 대시 보드 메인 패널 높이 문제

이것은

library(shiny) 
library(shinydashboard) 
library(shinyBS) 
library(DT) 

ui <- dashboardPage(
    dashboardHeader(), 
    dashboardSidebar(
    sidebarPanel(
     textInput("text", "Enter Id:"), 
     box(width = 1, background = 'purple'), 
     actionButton("Ok", "Press Ok",style='padding:8px; font-size:100%') 
    ) 

), 
    dashboardBody(

    mainPanel(width = 12, 

     tabsetPanel(

     tabPanel("About", value=1, h6("The objective is to test width of ShinyApp in tabPanel design", br(), 
             br(), 

             "Distribution Prototype" 

            ) 
       ), 


     tabPanel("Data", value=2, 

       fluidRow(

        valueBoxOutput("vbox1", width = 2), 
        valueBoxOutput("vbox2", width = 2), 
        valueBoxOutput("vbox3", width = 2), 
        valueBoxOutput("vbox4", width = 2), 
        valueBoxOutput("vbox5", width = 2), 
        valueBoxOutput("vbox6", width = 2) 


       ), 

       fluidRow(

        column(width = 4, box(title = "Iris", width = NULL, solidHeader = FALSE, dataTableOutput("dat1"))), 
        column(width = 4, box(title = "MT Cars", width = NULL, solidHeader = FALSE, dataTableOutput("dat2"))), 
        column(width = 4, box(title = "Old Faithful Gyser", width = NULL, solidHeader = FALSE, dataTableOutput("dat3")))), 

       fluidRow(


        column(width = 4, box(title = "Plot1", width = NULL, solidHeader = FALSE, plotOutput("plot1", height = "600px"))), 
        column(width = 4, box(title = "Plot2", width = NULL, solidHeader = FALSE, plotOutput("plot2", height = "600px"))), 
        column(width = 4, box(title = "Plot3", width = NULL, solidHeader = FALSE, plotOutput("plot3", height = "600px"))) 


       ) 

     ) 
    ) 
    ) 
)) 

server <- function(input, output) { 

    output$vbox1 <- renderValueBox({ valueBox("One","Yes",icon = icon("stethoscope"))}) 
    output$vbox2 <- renderValueBox({ valueBox("Two","Yes",icon = icon("stethoscope"))}) 
    output$vbox3 <- renderValueBox({ valueBox("Three","Yes",icon = icon("stethoscope"))}) 
    output$vbox4 <- renderValueBox({ valueBox("Four","Yes",icon = icon("stethoscope"))}) 
    output$vbox5 <- renderValueBox({ valueBox("Five","Yes",icon = icon("stethoscope"))}) 
    output$vbox6 <- renderValueBox({ valueBox("Six","Yes",icon = icon("stethoscope"))}) 

    output$dat1 <- renderDataTable({datatable(iris)}) 
    output$dat2 <- renderDataTable({datatable(mtcars,extensions = 'Responsive')}) 
    output$dat3 <- renderDataTable({datatable(faithful,rownames = FALSE, options = list(autoWidth = TRUE) )}) 

} 

shinyApp(ui, server) 

플롯은 기본 레이아웃 공간의 바깥으로 튀어 나와 내가 높이를 증가시키기 위해 mainPanel()의 모든 옵션을 찾을 수 있지 않다 아래에있는 내 코드입니다. 나는이 mainPanel(width = 12, height, 20 ....)과 같은 mainPanel() 안에 높이 값을 강제로 넣으려고 시도했으나 작동하지 않았습니다. 어떤 제안이라도 대단히 감사합니다.

+ Main Panel Height issue

--------- -------------이 도움이된다면

확실하지 업데이트,이 문제가되지 않습니다 때 당신은 shinydashboard의 기능이 아니라 표준 shiny 패키지를 사용하지 않는

library(shiny) 
library(shinydashboard) 
library(DT) 

ui <- dashboardPage(
    dashboardHeader(title = "Dynamic boxes"), 


    dashboardSidebar(
    conditionalPanel(condition="input.tabselected==3", 
        textInput("text", "Enter Id:"), 
        box(width = 1, background = 'purple'), 
        actionButton("Ok", "Press Ok",style='padding:8px; font-size:100%') 
    ) 
), 
    dashboardBody(
    fluidRow(

     valueBoxOutput("vbox1", width = 2), 
     valueBoxOutput("vbox2", width = 2), 
     valueBoxOutput("vbox3", width = 2), 
     valueBoxOutput("vbox4", width = 2), 
     valueBoxOutput("vbox5", width = 2), 
     valueBoxOutput("vbox6", width = 2) 


    ), 

    fluidRow(

     column(width = 4, box(title = "Iris", width = NULL, solidHeader = FALSE, dataTableOutput("dat1"))), 

     column(width = 4, box(title = "MT Cars", width = NULL, solidHeader = FALSE, dataTableOutput("dat2"))), 

     column(width = 4, box(title = "Old Faithful Gyser", width = NULL, solidHeader = FALSE, dataTableOutput("dat3"))) 


), 

    fluidRow(


    column(width = 4, box(title = "Plot1 ", width = NULL, solidHeader = FALSE, plotOutput("plot1", height = "600px"))), 
    column(width = 4, box(title = "Plot2", width = NULL, solidHeader = FALSE, plotOutput("plot2", height = "600px"))), 
    column(width = 4, box(title = "Plot3", width = NULL, solidHeader = FALSE, plotOutput("plot3", height = "600px"))) 


) 



) 
) 


server <- function(input, output) { 

    output$vbox1 <- renderValueBox({ valueBox("One","Yes",icon = icon("stethoscope"))}) 
    output$vbox2 <- renderValueBox({ valueBox("Two","Yes",icon = icon("stethoscope"))}) 
    output$vbox3 <- renderValueBox({ valueBox("Three","Yes",icon = icon("stethoscope"))}) 
    output$vbox4 <- renderValueBox({ valueBox("Four","Yes",icon = icon("stethoscope"))}) 
    output$vbox5 <- renderValueBox({ valueBox("Five","Yes",icon = icon("stethoscope"))}) 
    output$vbox6 <- renderValueBox({ valueBox("Six","Yes",icon = icon("stethoscope"))}) 

    output$dat1 <- renderDataTable({datatable(iris)}) 
    output$dat2 <- renderDataTable({datatable(mtcars,extensions = 'Responsive')}) 
    output$dat3 <- renderDataTable({datatable(faithful,rownames = FALSE, options = list(autoWidth = TRUE) )}) 
    #output$dat4 <- renderDataTable({datatable(data.frame(HairEyeColor),extensions = 'Responsive')}) 
} 

shinyApp(ui, server) 
+0

당신은 그 관계가, kevin.arseneau @'600px' –

+0

에 플롯의 높이를 하드 코딩했다. –

답변

3

) (mainpanel를 사용하고 당신은 fluidRow 내부에 tabBox을 포장 필요 없어요.

library(shiny) 
library(shinydashboard) 
library(shinyBS) 
library(DT) 

ui <- dashboardPage(
    dashboardHeader(), 
    dashboardSidebar(
    sidebarPanel(
     textInput("text", "Enter Id:"), 
     box(width = 1, background = 'purple'), 
     actionButton("Ok", "Press Ok",style='padding:8px; font-size:100%') 
    ) 

), 
    dashboardBody(

       fluidRow(
       tabBox(width = 12, height = NULL, 

       tabPanel("About", value=1, h6("The objective is to test width of ShinyApp in tabPanel design", br(), 
               br(), 

               "Distribution Prototype" 

       ) 
       ), 


       tabPanel("Data", value=2, 

         fluidRow(

          valueBoxOutput("vbox1", width = 2), 
          valueBoxOutput("vbox2", width = 2), 
          valueBoxOutput("vbox3", width = 2), 
          valueBoxOutput("vbox4", width = 2), 
          valueBoxOutput("vbox5", width = 2), 
          valueBoxOutput("vbox6", width = 2) 


         ), 

         fluidRow(

          column(width = 4, box(title = "Iris", width = NULL, solidHeader = FALSE, dataTableOutput("dat1"))), 
          column(width = 4, box(title = "MT Cars", width = NULL, solidHeader = FALSE, dataTableOutput("dat2"))), 
          column(width = 4, box(title = "Old Faithful Gyser", width = NULL, solidHeader = FALSE, dataTableOutput("dat3")))), 

         fluidRow(


          column(width = 4, box(title = "Plot1", width = NULL, solidHeader = FALSE, plotOutput("plot1"))), 
          column(width = 4, box(title = "Plot2", width = NULL, solidHeader = FALSE, plotOutput("plot2"))), 
          column(width = 4, box(title = "Plot3", width = NULL, solidHeader = FALSE, plotOutput("plot3"))) 


         ) 

       ) 
      ) 
    ) 
)) 

server <- function(input, output) { 

    output$vbox1 <- renderValueBox({ valueBox("One","Yes",icon = icon("stethoscope"))}) 
    output$vbox2 <- renderValueBox({ valueBox("Two","Yes",icon = icon("stethoscope"))}) 
    output$vbox3 <- renderValueBox({ valueBox("Three","Yes",icon = icon("stethoscope"))}) 
    output$vbox4 <- renderValueBox({ valueBox("Four","Yes",icon = icon("stethoscope"))}) 
    output$vbox5 <- renderValueBox({ valueBox("Five","Yes",icon = icon("stethoscope"))}) 
    output$vbox6 <- renderValueBox({ valueBox("Six","Yes",icon = icon("stethoscope"))}) 

    output$dat1 <- renderDataTable({datatable(iris)}) 
    output$dat2 <- renderDataTable({datatable(mtcars,extensions = 'Responsive')}) 
    output$dat3 <- renderDataTable({datatable(faithful,rownames = FALSE, options = list(autoWidth = TRUE) )}) 

} 

shinyApp(ui, server) 
+0

감사합니다. Kevin, 저는 대시 보드의 기능을 주로 이해하고 있습니다. –

+0

@SundownBrownbear, 걱정할 필요가 없습니다. 노력은 보람이있을 것입니다. –

관련 문제