简体   繁体   中英

R shiny dashboard output panel issue

I have created the following dashboard in shiny

I first import the folloiwng libraries in R

 library(shinydashboard)
 library(shiny)
 library(DT)
 library(shinyWidgets)
 library(readxl)

We first create the UI here to provide an date, fileimport, a nmeric input and an action button

  ui=shinyUI(
  dashboardPage(
  dashboardHeader(

  title = "Chart",
  titleWidth = 850
   ),
  dashboardSidebar(   


  # Change font size here



     tags$head( 
     tags$style(HTML(".main-sidebar { font-size: 20px; }"), style = 
     "background-color: #78d9c9;") #change the font size to 20
      ),



     fileInput(inputId = "file", label = 'Load Dataset Here',placeholder = 
    "Upload",
            multiple = TRUE,
            accept = c("xlsx/xls",".xls",".xlsx"), width = "100%"),
         dateInput(inputId = 'Cutoffdate',label =  'Cut Off date'), 

     numericInput(inputId = 'AAA',label =  'AAA', value = 0, min = 0, max = 
    120, step = 6),# Add new font color here

      actionButton(inputId = 'Button',label ='Generate Chart', style="color: 
  #fff; background-color: #599AC3; border-color: #2e6da4, :font-color: 
  black")
   ),
dashboardBody(

  tags$head(tags$style(HTML('
                            /* logo */
                            .skin-blue .main-header .logo {
                            background-color:   #7CFC00;
                            }

                            /* logo when hovered */
                            .skin-blue .main-header .logo:hover {
                            background-color:   #7CFC00;
                            }

                            /* navbar (rest of the header) */
                            .skin-blue .main-header .navbar {
                            background-color:   #7CFC00;
                            }

                            # Sidebar color here
                            /* main sidebar */
                            .skin-blue .main-sidebar {
                            background-color:   #F4A460;
                            }

                            /* active selected tab in the sidebarmenu */
                            .skin-blue .main-sidebar .sidebar .sidebar-menu 
          .active a{
                            background-color: #FFF8DC;
                            }

                            /* other links in the sidebarmenu */
                            .skin-blue .main-sidebar .sidebar .sidebar-menu 
                       a{
                            background-color: #FFF8DC;
                            color:#A9A9A9;
                            }

                            /* other links in the sidebarmenu when hovered 
                         */
                            .skin-blue .main-sidebar .sidebar .sidebar-menu 
                            a:hover{
                            background-color: #FFF8DC;
                            }
                            /* toggle button when hovered  */
                            .skin-blue .main-header .navbar .sidebar- 
                            toggle:hover{
                            background-color: #FFF8DC;
                            }

                            /* body */
                            .content-wrapper, .right-side {
                            background-color: #FFF8DC;
                            }

                            '))



                       ),

                      mainPanel(

                    fluidRow(
                   column(12,plotlyOutput("plot1" , height = 600, 
                   width=1200))

                    ), fluidRow(  column(7,tableOutput(outputId = 
                    "Table2"))),



                      fluidRow(column(12,dataTableOutput(outputId = 
                      "Table1")))


                       )


                       )


                       )
                       )

Next we create a server

     server<-function(input, output){


    output$Table1<-renderDataTable({airquality}) 

   #output$plot1<-renderPlot({hist(airquality$Ozone)})

    output$Table2<-renderTable({airquality})




 }
shinyApp(ui, server =server)

The color background in the main panel is not extending all the way down. The second table is set against a white background. Is there a way to expand the outputpanel size to do this

The solution is simple. One needs to just remove mainpanel() in the UI.

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