【问题标题】:How do I adjust the height of a widget in an R Shiny App?如何在 R Shiny App 中调整小部件的高度?
【发布时间】:2014-08-15 08:29:03
【问题描述】:

我目前正在使用以下代码创建一个小部件:

selectInput("City", label = h5("City"), 
choices = list("Miami","San Francisco", "Chicago" ,
"New York","Los Angeles" ), selected = 1)

我了解 selectInput 有一个宽度参数:http://shiny.rstudio.com/reference/shiny/latest/selectInput.html

但我对如何调整小部件的高度感到困惑。

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    您可以使用 CSS 来定位选择控件并调整高度:

    runApp(list(
      ui = bootstrapPage(
        numericInput('n', 'Number of obs', 100),
        selectInput("City", label = h5("City"), 
                    choices = list("Miami","San Francisco", "Chicago" ,
                                   "New York","Los Angeles" ), selected = 1),
        plotOutput('plot'),
        tags$head(
          tags$style(
            ".selectize-dropdown, .selectize-input, .selectize-input { 
               line-height: 54px; 
              }"
          )
        )
      ),
      server = function(input, output) {
        output$plot <- renderPlot({ hist(runif(input$n)) })
      }
    ))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-18
      • 1970-01-01
      • 2021-09-20
      • 1970-01-01
      • 2013-04-14
      • 2021-08-31
      • 2021-10-13
      • 2018-05-25
      相关资源
      最近更新 更多