r - RShiny:如何使滑块居中
问题描述
我是 RShiny 的新手,我正在尝试复制此模板:https ://shiny.rstudio.com/gallery/retirement-simulation.html 我确实有此模板的代码,但这是一个学习练习。
这是我到目前为止所拥有的:
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"))
)
)
)
)
它看起来不错,但我需要像上面的模板一样将滑块居中。非常感谢正确方向的指点!
谢谢,
乔斯夫
解决方案
使用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
)
)
推荐阅读
- sql-server - 用于 Windows 身份验证远程的数据原子 cson 配置
- google-apps-script - 当列不为空时自动包含/删除复选框
- java - 如何使用 for 循环打印对象的名称
- node.js - Microsoft bot 未从 Firebase 云功能做出响应
- google-sheets - 加入 importrange 和 Query
- angular - Angular,将选择器存储数据发送到子组件
- python - 当我尝试创建多个分支时,它不断给我一个名称错误
- python - delta_time 如何在 python 街机上工作?
- python - 使用 Flask 将多个按钮单击附加到列表
- php - 在 Wordpress 中对来自外部 API 的数据进行排序