【问题标题】:Reducing space between two box() in R shiny减少 R 中两个 box() 之间的空间
【发布时间】:2018-02-18 06:53:17
【问题描述】:

给定的脚本会生成一个简单的直方图和两个框内的滑块。我希望减少两个框之间的空间,以及它们与屏幕末端的极端边界之间的空间。请帮忙,谢谢。snapshot of the plots

## app.R ##
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(
width = 0
),
dashboardBody(
# Boxes need to be put in a row (or column)
fluidRow(
box(title = "Activity Frequency", status = "primary",height = "520", 
solidHeader = T,
plotOutput("plot1")),
box(title = "Activity Frequency", status = "primary",height = "520", 
solidHeader = T,
sliderInput("slider", "Number of observations:", 1, 100, 50))
)
)
)
server <- function(input, output) {
set.seed(122)
histdata <- rnorm(500)
output$plot1 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
}
shinyApp(ui, server)

【问题讨论】:

  • 要减少填充,您可以将tags$head(tags$style(HTML("div.col-sm-6 {padding:1px}"))), 添加到dashboardBody
  • 尊敬的先生,完美的作品,如果你能帮助我从盒子的左右两侧缩小到屏幕末端的尺寸,将不胜感激。
  • 对不起,我帮不了你。
  • @lukeA,需要通过此链接获得类似但略有不同的帮助:stackoverflow.com/questions/47154749/…

标签: r shiny shinydashboard shinyapps


【解决方案1】:

cmets 中的答案对我不起作用。经过一些试验和错误,有效的是:

dashboardBody(tags$head(tags$style(HTML('
.box {margin: 5px;}'
)))

只需在您的 HTML 样式标签中包含 .box {margin: 5px;}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-05-30
    • 1970-01-01
    • 1970-01-01
    • 2015-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多