5

给定的脚本在两个框中生成一个简单的直方图和一个滑块。我希望减少两个框之间的空间,以及它们与屏幕末端的极端边界之间的空间。请帮助和感谢。地块快照

## 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)
4

1 回答 1

2

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

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

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

于 2018-09-04T17:26:54.387 回答