r - 侧栏中 Shiny 的调整按钮位置

标签 r shiny

我正在使用 Shiny Dashboard 来尝试学习它

我创建了下面的脚本(由于保密原因删除了一些内容),其中给出了选择标准日期、国家/地区和一个进程按钮,旁边有一个下载按钮

不幸的是,进程按钮并没有真正位于其他对象下方的中心。有没有一种方法可以让我将进程按钮向右推几个像素?

library(shinydashboard)
header <- dashboardHeader(title = "Some Header")

sidebar <- dashboardSidebar(br(),title = "Selection Options",
                        uiOutput("choose_daterange"),
                        uiOutput("choose_ctry"),
                        br(),
                        actionButton("run_report", "Process", icon =    icon("refresh")),
                        actionButton("download", "Download", icon = icon("download"))
) 



body <- dashboardBody("Hello World")


# Pulling it all together
dashboardPage(
 skin = "yellow",
  header,
  sidebar,
  body
)  

最佳答案

尝试在代码中添加 html 样式标签:

sidebar <- dashboardSidebar(br(),title = "Selection Options",
                            uiOutput("choose_daterange"),
                            uiOutput("choose_ctry"),
                            br(),
                            actionButton("run_report", "Process", icon = icon("refresh")),
                            actionButton("download", "Download", icon = icon("download")),
                            tags$style(type='text/css', "#run_report { width:50%; margin-left: 5px;}")

) 

您可以调整宽度以确保按钮的长度/宽度相等

关于r - 侧栏中 Shiny 的调整按钮位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43872859/

相关文章:

R:ggplot 在 2x2 阶乘实验中填充一个因子

r - 在单个图中获取 geom_hex 中的观测值( Shiny )

arrays - 对 3 维数组进行子集化时不要删除维度

r - 使用 data.table 查找子组中的相同行

javascript - R Shiny : selectInput items always scroll on top of a fixedPanel

R Shiny : Output functions don't work within eventReactive()

r - 按日期排序的两侧条形图

r - Shiny 的模块不适用于 renderUI

javascript - 在 Cloud Foundry 上运行 Shiny 应用程序的 R 构建包和 Assets 的 JavaScript 构建包

r - 使用 dygraphs 部署 r shiny 应用程序时遇到问题