2016-04-21 70 views
9

我有一个顶部横幅,我想分成两个单独的部分代表两个不同的输入。为此,我创建了一个FluidRow和两列,每个输入一列。但是,现在在列之间有一些空白区域,尽管将偏移量设置为0.是否有任何方法可以删除此空白区域,以便列之间紧邻?发光的流体列白色空间

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) 

回答

17

白色空间是填充的列div。若要删除,使用

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

工作就像一个魅力,谢谢! – Peter