简体   繁体   English

R Shiny 中 2 个小部件之间的空间

[英]Space between 2 widgets in R Shiny

Can someone please explain me the reason for having a big whitespace between following?有人可以解释一下在关注之间有大空格的原因吗?

server = function(input, output){    
  
  # server code
}
ui = fluidPage(
  
  fluidRow(
    column(8, offset = 0, style='padding:0px;', # Sidebar panel
           sidebarPanel(useShinyjs(),
                         
                         dateRangeInput('dateRange',
                                        label = 'Filter crimes by date',
                                        start = as.Date('2019-01-01') , end = as.Date('2021-06-01')),
                         
                         selectInput("var", label = "1. Select the quantitative Variable", 
                                     choices = c("place_of_death"=3,"Month Name"=11, "cause_of_death"=8), selected = 8), 
                         
                         radioButtons( "dist", "Enable or disable Grouping:",
                                       c("Enable" = "enable",
                                         "Disable" = "disable" ), inline=T),
                         
                         selectInput("var2", label = "1. Select the quantitative Variable", 
                                     choices = c("cause_of_death"=8, "year"=7), selected = 7),
                         
                         
                         radioButtons( "CauseOfDeathRad", "Enable or disable Grouping:",
                                       c("Covid" = "covid",
                                         "Non-Covid" = "nonCovid" ,
                                         "Both" = "both"), inline=T),
                         
                         radioButtons( "DeathonYearRad", "Enable or disable Grouping:",
                                       c(
                                         "2020" = "2020" ,
                                         "2021" = "2021",
                                         "All" = "All"), inline=T)
                         
           )),
    column(2, offset = 0, style='padding:0px;', wellPanel(p("Column width 2"))),
    column(2, offset = 0, style='padding:0px;', wellPanel(p("Column width 2")))
    )
)
shinyApp(ui = ui, server = server)

I need my dashboard to be equally divided among different plots.我需要我的仪表板在不同的地块之间平均分配。 But this seems really hard to be done.但这似乎真的很难做到。 Appreciate if someone could help感谢有人可以提供帮助

PS. PS。 在此处输入图像描述

When column(8,...) is set to column(3...)当 column(8,...) 设置为 column(3...)

My suggestion is to use the fluidRow() and column() in the mainPanel() to display the plots.我的建议是使用mainPanel()中的fluidRow()column() ) 来显示绘图。 Widgets for input can be kept in sidebarPanel() .用于输入的小部件可以保存在sidebarPanel()中。 Try this尝试这个

server = function(input, output){    
  
  # server code
}
ui = fluidPage(
  useShinyjs(),
  sidebarLayout(
    sidebarPanel(
      
      dateRangeInput('dateRange',
                     label = 'Filter crimes by date',
                     start = as.Date('2019-01-01') , end = as.Date('2021-06-01')),
      
      selectInput("var", label = "1. Select the quantitative Variable", 
                  choices = c("place_of_death"=3,"Month Name"=11, "cause_of_death"=8), selected = 8), 
      
      radioButtons( "dist", "Enable or disable Grouping:",
                    c("Enable" = "enable",
                      "Disable" = "disable" ), inline=T),
      
      selectInput("var2", label = "1. Select the quantitative Variable", 
                  choices = c("cause_of_death"=8, "year"=7), selected = 7),
      
      
      radioButtons( "CauseOfDeathRad", "Enable or disable Grouping:",
                    c("Covid" = "covid",
                      "Non-Covid" = "nonCovid" ,
                      "Both" = "both"), inline=T),
      
      radioButtons( "DeathonYearRad", "Enable or disable Grouping:",
                    c(
                      "2020" = "2020" ,
                      "2021" = "2021",
                      "All" = "All"), inline=T)
      
    ),
    mainPanel(
      fluidRow(
        column(5, offset = 0, style='padding:0px;', wellPanel(p("Column width 5"))),
        column(5, offset = 0, style='padding:0px;', wellPanel(p("Column width 5")))
      )
    )
  )
  
)
shinyApp(ui = ui, server = server)

输出

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM