如何处理流体行内的空间

时间:2018-07-25 21:27:49

标签: 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/")
               )) 
      )
        )
  )

谢谢您的帮助。

enter image description here

1 个答案:

答案 0 :(得分:0)

您通常可以在单列中添加多行,这样它们就可以彼此堆叠。 请参考此链接以获取最多可添加的列数

请参阅此处以查看列的工作方式[https://shiny.rstudio.com/reference/shiny/latest/column.html]

还请提供一个示例代码,其中包含您要查看的特定代码。