【问题标题】:how to handle space inside a fluidrow rshiny如何处理fluidrow r闪亮内部的空间
【发布时间】:2019-01-02 19:20:05
【问题描述】:

我对 r shiny 还很陌生,我只是在考虑如何处理行之间的这个空白空间。我可以利用这个空间添加更多的块或瓷砖,如果可以的话,我该如何向上移动它?

一般来说,UI页面上的所有块如何排列?

这是我从图库中获得的 UI.R 并进行了一些更改。

      output$te <- renderUI(

    fluidPage(

      tags$head(tags$style(HTML("
                                .shiny-text-output {
                                background-color:#fff;
                                }
                                "))),

      h1("Offer", span("Simulator", style = "font-weight: 300"), 
         style = "font-family: 'Source Sans Pro';
         color: #fff; text-align: center;
         background-image: url('texturebg.png');
         padding: 20px"),
      br(),

      fluidRow(

        column(4,
               wellPanel(
                 h3("Brands"),
                 dropdownButton(
                   label = "check Brands", status = "default", width = 450,
                   tags$label("Choose :"),
                   fluidRow(
                     column(
                       width = 12,
                       checkboxGroupInput("brands", "Brands:",
                                          as.character(unique(unlist(myData()[['Brand1']]))))
                     )
                   )
                 )
               )),

        column(4,
               wellPanel(
                 h3("Category"),
                 dropdownButton(
                   label = "Categories", status = "default", width = 450,
                   tags$label(),
                   fluidRow(
                     column(
                       width = 12,
                       checkboxGroupInput("categories", "categories:",
                                          as.character(unique(unlist(myData()[['Category']]))))
                     )
                   )
                 )
               )),

        column(4,
               wellPanel(
                 h3("User Inputs"),
                 numericInput("distribution_variable", "Distribution Variable", 0.13),
                 numericInput("insertion_cost", "Insertion_cost", 300),
                 numericInput("circulation", "Total Circulation", 100000),
                 numericInput("r_perc", "Redemption_Percentage", 1.5),
                 numericInput("face_value", "Face Value", 2)
               ))
      ),

      fluidRow(

        column(4,
               wellPanel(
                 dateInput("date", label = h3("Date input"), value = "2014-01-01"),  
                 hr(),
                 p("Current Value:", style = "color:#888888;"), 
                 verbatimTextOutput("dateOut"),
                 a("See Code", class = "btn btn-primary btn-md",  
                   href = "https://gallery.shinyapps.io/071-widget-date/")
               )),

        column(4,
               wellPanel(
                 dateRangeInput("dates", label = h3("Date range")),
                 hr(),
                 p("Current Values:", style = "color:#888888;"), 
                 verbatimTextOutput("datesOut"),
                 a("See Code", class = "btn btn-primary btn-md",  
                   href = "https://gallery.shinyapps.io/072-widget-date-range/")
               )),

        column(4,
               wellPanel(
                 fileInput("file", label = h3("File input")),
                 hr(),
                 p("Current Value:", style = "color:#888888;"), 
                 verbatimTextOutput("fileOut"),
                 a("See Code", class = "btn btn-primary btn-md",  
                   href = "https://gallery.shinyapps.io/073-widget-file/")
               ))
      ),

      fluidRow(

        column(4,
               wellPanel(
                 numericInput("num", label = h3("Numeric input"), value = 1),
                 hr(),
                 p("Current Value:", style = "color:#888888;"), 
                 verbatimTextOutput("numOut"),
                 a("See Code", class = "btn btn-primary btn-md",  
                   href = "https://gallery.shinyapps.io/074-widget-numeric/")
               )),

        column(4,
               wellPanel(
                 radioButtons("radio", label = h3("Radio buttons"),
                              choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), 
                              selected = 1),
                 hr(),
                 p("Current Values:", style = "color:#888888;"), 
                 verbatimTextOutput("radioOut"),
                 a("See Code", class = "btn btn-primary btn-md",  
                   href = "https://gallery.shinyapps.io/075-widget-radio/")
               )),

        column(4,
               wellPanel(
                 selectInput("select", label = h3("Select box"), 
                             choices = list("Choice 1" = 1, "Choice 2" = 2,
                                            "Choice 3" = 3), selected = 1),
                 hr(),
                 p("Current Value:", style = "color:#888888;"), 
                 verbatimTextOutput("selectOut"),
                 a("See Code", class = "btn btn-primary btn-md",  
                   href = "https://gallery.shinyapps.io/076-widget-select/")
               ))
      ),

      fluidRow(

        column(4,
               wellPanel(
                 sliderInput("slider1", label = h3("Slider"), min = 0, max = 100, 
                             value = 50),
                 hr(),
                 p("Current Value:", style = "color:#888888;"), 
                 verbatimTextOutput("slider1Out"),
                 a("See Code", class = "btn btn-primary btn-md",  
                   href = "https://gallery.shinyapps.io/077-widget-slider/")
               )),

        column(4,
               wellPanel(
                 sliderInput("slider2", label = h3("Slider range"), min = 0, 
                             max = 100, value = c(25, 75)),
                 hr(),
                 p("Current Values:", style = "color:#888888;"), 
                 verbatimTextOutput("slider2Out"),
                 a("See Code", class = "btn btn-primary btn-md",  
                   href = "https://gallery.shinyapps.io/077-widget-slider/")
               )),
        column(4,
               wellPanel(
                 textInput("text", label = h3("Text input"), 
                           value = "Enter text..."),
                 hr(),
                 p("Current Value:", style = "color:#888888;"), 
                 verbatimTextOutput("textOut"),
                 a("See Code", class = "btn btn-primary btn-md",  
                   href = "https://gallery.shinyapps.io/080-widget-text/")
               )) 
      )
        )
  )

感谢您的帮助。

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    您通常可以在一列中添加多行,以便它们相互堆叠。 有关可以添加的最大列数,请参阅此链接

    请参阅此处了解列的工作原理 [https://shiny.rstudio.com/reference/shiny/latest/column.html]

    另外,请附上您的代码的工作示例,其中包含您希望看到的特定内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-04
      • 2014-05-27
      • 1970-01-01
      • 2012-11-14
      • 2020-10-16
      • 1970-01-01
      • 2018-05-13
      • 2016-08-15
      相关资源
      最近更新 更多