簡體   English   中英

R Shiny 中 2 個小部件之間的空間

[英]Space between 2 widgets in R Shiny

有人可以解釋一下在關注之間有大空格的原因嗎?

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)

我需要我的儀表板在不同的地塊之間平均分配。 但這似乎真的很難做到。 感謝有人可以提供幫助

PS。 在此處輸入圖像描述

當 column(8,...) 設置為 column(3...)

我的建議是使用mainPanel()中的fluidRow()column() ) 來顯示繪圖。 用於輸入的小部件可以保存在sidebarPanel()中。 嘗試這個

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