代码之家  ›  专栏  ›  技术社区  ›  Raghavan vmvs

排列有光泽的侧栏对象

  •  1
  • Raghavan vmvs  · 技术社区  · 7 年前

    我使用R.shiny创建了以下界面。

      library(shiny)
    
    
    
    
      ui <- fluidPage(
      #Can be fluid row also
      fluidRow(
      column(3,
           h3("Excel DB"),
           hr(),
           fileInput("file1", "Excel DB",
                     multiple = TRUE,
                     accept = c("text/csv/xlsx/xls",
                                "text/comma-separated-values,text/plain",
                                ".csv", ".xls", ".xlsx")),
           textInput(inputId = 'Type',label =  'Type'),
           textInput(inputId = 'Client',label =  'Client'),
           textInput(inputId = "Task", label = "Task"),
           actionButton(inputId = "ClearAll", label = "Clear Screen"),
           radioButtons("dist", "Vertical Axis Scale",
                        c("Linear" = "Linear Regression",
                          "Log" = "Logistic Regression"))
    ),
    column(5,h5('              '),
           hr(), downloadButton(outputId = "Downloaddata", label = "Fetch Dataset"),
           textInput(inputId = "Commodity", label = "Commodity"),
           textInput(inputId = "Year", label = "Year"),
           radioButtons("dist", "Horizontal Axis Scale",
                        c("Linear" = "Linear Regression",
                          "Log" = "Logistic Regression")),
           numericInput(inputId = "Numberinput", label = "Numinput", min = -1000000000, max = 1000000000, value = 0,step = 1)
    
    )
    ), sliderInput(inputId = "Scale", label = "Scale", min = 0, max = 100, step 
    = 2.5, value = 1)
    )
    

    我创建了以下空服务器

    server<-function(input, output){}
    shinyApp(ui, server)
    

    1 回复  |  直到 7 年前
        1
  •  1
  •   DanTan    7 年前

    要实现这一点,您需要对 column() fluidRow() . This answer Shiny's layout guide . 我相信以下几点可以大致满足您的需求:

    library(shiny)
    
    ui <- fluidPage(
      #Can be fluid row also
      h3("Excel DB"),
      hr(),
      fluidRow(
        column(12,
               fluidRow(
                 column(3,
                        fileInput("file1", NULL,
                                  multiple = TRUE,
                                  accept = c("text/csv/xlsx/xls",
                                             "text/comma-separated-values,text/plain",
                                             ".csv", ".xls", ".xlsx"))),
                 column(5,
                        column(3,
                               downloadButton(outputId = "Downloaddata", label = "Fetch Dataset")),
                        column(2, offset = 2,
                               actionButton(inputId = "ClearAll", label = "Clear Screen"))
                        )
               ),
               fluidRow(
                 column(3,
                        textInput(inputId = 'Type',label =  'Type'),
                        textInput(inputId = 'Client',label =  'Client'),
                        textInput(inputId = "Task", label = "Task")
                 ),
                 column(5,
                        textInput(inputId = "Commodity", label = "Commodity"),
                        textInput(inputId = "Year", label = "Year"),
                        numericInput(inputId = "Numberinput", label = "Numinput", min = -1000000000, max = 1000000000, value = 0,step = 1)
                 )),
               fluidRow(
                 column(3,
                        radioButtons("dist", "Vertical Axis Scale",
                                     c("Linear" = "Linear Regression",
                                       "Log" = "Logistic Regression"))),
                 column(5,
                        radioButtons("dist", "Horizontal Axis Scale",
                                     c("Linear" = "Linear Regression",
                                       "Log" = "Logistic Regression")))
                 ),
               fluidRow(
                 column(5,
                        sliderInput(inputId = "Scale", label = "Scale", min = 0, max = 100, 
                                    step = 2.5, value = 1)) 
                 )
               )
        )
      )
    

    reprex package (第0.2.1版)

    推荐文章