RShiny:如何使滑块居中
我是RShiny的新手,我正在尝试复制此模板: 我有这个模板的代码,但这是一个学习练习 以下是我到目前为止的情况:RShiny:如何使滑块居中,r,shiny,shinydashboard,shiny-server,shinyjs,R,Shiny,Shinydashboard,Shiny Server,Shinyjs,我是RShiny的新手,我正在尝试复制此模板: 我有这个模板的代码,但这是一个学习练习 以下是我到目前为止的情况: ui <- fluidPage( # Title goes here... titlePanel("Retirement: simulating wealth with random returns, inflation and withdrawals"), p("Description here..."), hr(), # Sidebar layou
ui <- fluidPage(
# Title goes here...
titlePanel("Retirement: simulating wealth with random returns, inflation and withdrawals"),
p("Description here..."),
hr(),
# Sidebar layout...
sidebarLayout(
# Sidebar panel...
sidebarPanel(
# Input: Slider for the number of observations to generate ----
sliderInput("n",
"Param 1",
value = 500,
min = 1,
max = 1000),
sliderInput("n",
"Param 2",
value = 500,
min = 1,
max = 1000),
sliderInput("n",
"Param 3",
value = 500,
min = 1,
max = 1000),
sliderInput("n",
"Param 4",
value = 500,
min = 1,
max = 1000)
),
# Main panel...
mainPanel(
# Outputs of any plots...
tabsetPanel(type = "tabs",
tabPanel("Plot", plotOutput("plot"))
)
)
)
)
ui您可以通过结合使用wellPanel、fluidRow和column来实现这一点
第一个fluidRow是将两个井面板以50%的分割并排固定。在每个井面板中,我们使用fluidRows定义一行,然后使用2列(宽度为6)定义2列(宽度为50%)
ui <- navbarPage("Test",
tabPanel("Data",
fluidRow(column(
6,
wellPanel(
fluidRow(column(
6, sliderInput("input1", "input1", 0, 100, 5)
),
column(
6, sliderInput("input2", "input2", 0, 100, 5)
)),
fluidRow(column(
6, sliderInput("input1", "input3", 0, 100, 5)
),
column(
6, sliderInput("input3", "input4", 0, 100, 5)
)),
fluidRow(column(
6, sliderInput("input1", "input5", 0, 100, 5)
),
column(
6, sliderInput("input2", "input6", 0, 100, 5)
))
)
))))
ui使用margin:auto
CSS规则:
div(style = "margin: auto; width: 80%", # this number can be any percentage you need
sliderInput(
...
width = "100%" # this number has to be "100%", nothing less
)
)
使用侧边栏面板中的列
参数…另一个选项是使用框
设置滑块周围的框,以获得更精细的控制。我已经试过了,但我不理解列宽1-12部分。如何让16个滑块按4×4对齐,就像上面的示例一样?