【问题标题】:Nested fluidRow layout in ShinyShiny中的嵌套fluidRow布局
【发布时间】:2020-04-19 19:20:48
【问题描述】:

我想创建fluidPage,如上图所示。

这是我的 ui.R 代码:

shinyUI(fluidPage(
                fluidRow(
                            column(6,
                                   selectInput(inputId="StoreName", label=h3("Choose Store"),choices = vStores),
                                  ),
                            column(6,
                                   strong(h3("Latest Orders Status")),
                                   DT::dataTableOutput('getLatestOrdStatus'),
                                   style = "height:500px; overflow-y: scroll;"
                                  )
                          ),
                fluidRow(   
                            column(6,     
                            selectInput(inputId="OrderType", label=h3("Choose Order Type"),choices = vOrdTypes)
                                )
                        ),
                fluidRow(
                            column(5, h4("Daily Orders Count By Order Type"),
                                   dateRangeInput(inputId="daterange", label="Pick a Date Range:", start = Sys.Date()-30, 
                                                  end = Sys.Date()),
                                   plotOutput("OrdPlotByType")
                                   )
                        )

             )
 )      

【问题讨论】:

    标签: shiny shinydashboard shinyjs shiny-reactivity shinyapps


    【解决方案1】:

    下面的代码会给你类似的布局。进一步你可以通过探索这个来自闪亮的link 来改进

    library(shiny)
    library(DT)
    library(ggplot2)
    
    data(mtcars)
    ui <- fluidPage(
      fluidRow(column(12,  style = "background-color:#999999;",
    
      fluidRow(column(6,
                      fluidRow( column(6, selectInput(inputId = "StoreName", label = h3("Select Input 1"),choices = c('a', 'b')))),
                      fluidRow(column(6, selectInput(inputId = "OrderType", label = h3("Select Input 2"),choices = c('a', 'b')))),
                      fluidRow(column(12, h4("Plot Output"), plotOutput('plot'))
                               )) ,
      column(6, strong(h3("Table Output")),dataTableOutput('table')
             )  
      )
      )
      )
    )
    
    
    server <- function(input, output) {
      data <- data.frame(
        name = c("A","B","C","D","E") ,  
        value = c(3,12,5,18,45) )
      output$table <- renderDataTable(head(mtcars))
      output$plot <- renderPlot(
        ggplot(data, aes(x = name, y = value)) + 
          geom_bar(stat = "identity")
      )
    }
    shinyApp(ui, server)
    

    【讨论】:

      猜你喜欢
      • 2020-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多