闪亮的流体行列空白 [英] shiny fluidrow column white space

查看:15
本文介绍了闪亮的流体行列空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个顶部横幅,我想将其分成代表两个不同输入的两个独立部分.为此,我创建了一个 fluidRow 并有两列,每个输入一列.但是,尽管设置了 offset = 0,但现在列之间还是有一点空白.有什么办法可以删除这个空白,使列紧挨着?

I have a top banner that I want to split into two separate sections representing two different inputs. To do this, I've created a fluidRow and with two columns, one for each input. However, as it is now there is a little bit of white space between the columns, despite putting offset = 0. Is there any way to remove this white space so that the columns are immediately next to one another?

colors = c("green","blue","red")
library(shiny)

ui <- fluidPage(

  tabsetPanel(
    tabPanel("Info",
             fluidRow( 
                   column(width = 6, offset = 0,
                      div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",
                          tags$h3("Section 1")
                      )
                   ),
                   column(width = 6, offset = 0,
                       div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",       
                          tags$h3("Section 2")
                       )
                   ) 
             ),
             fluidRow(
                   column(width = 6, offset = 0,
                   div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",       
                       selectInput(inputId = "color",label = "color:",
                                   choices = colors,
                                   selected = colors[2],
                                   multiple = FALSE)
                      )
                    ),
                   column(width = 6, offset = 0,
                          div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",       
                              selectInput(inputId = "points",label = "Number of Points:",
                                          choices = c("30","60","90"),
                                          selected = "10",
                                          multiple = FALSE)                      )
                   )
             ),   
             br(),
             br(),
             fluidRow(
                   actionButton(inputId = "go",
                                label = "Update"
                   )
             ),
             fluidRow(
                   plotOutput("plot", width = "100%")
             )

    )
  )
)


server <- function(input, output,session) {

  data = eventReactive(input$go, {
    var1 = rnorm(isolate(as.numeric(input$points)),5)
    cat1 = c(rep("red",length(var1)/3),rep("blue",length(var1)/3),rep("green",length(var1)/3))
    data = cbind.data.frame(var1,cat1)
    plotdata = data[which(data$cat1 ==isolate(input$color)),] 
  }
  )

  output$plot = renderPlot({
    plotdata = data()
    plotcol = isolate(input$color)
    plot(plotdata$var1, col = plotcol) 
  })
}

shinyApp(ui = ui,server = server)

推荐答案

空白是 div 列的填充.要删除它,请使用

The white space is the padding of the column div. To remove that, use

column(width = 6, offset = 0, style='padding:0px;', ...)

这篇关于闪亮的流体行列空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆