在 shinydashboard 中跳过 2 个 fluidRows 之间的空 space
Skip empty space between 2 fluidRows in a shinydashboard
我在下面的 shinydashboard
中几乎删除了页眉并在正文顶部添加了一个图像。在它下面有两排框问题是图像和 fluidRow()
之间有太多浪费的空白 space 正如您在 scrshot 中看到的那样。
## app.R ##
library(shiny)
library(shinydashboard)
library(shinyjs)
library(tableHTML)
ui <- dashboardPage(
dashboardHeader(titleWidth = 0,
tags$li(class = "dropdown",
tags$style(".main-header {max-height: 0px}"),
tags$style(".main-header .logo {height: 0px;}"),
tags$style(".sidebar-toggle {height: 0px; padding-top: 0px !important;}"),
tags$style(".navbar {min-height:0px !important}")
) ),
dashboardSidebar(
checkboxGroupInput("box", "Select box",
c("Red", "Green", "Blue", "Yellow"),selected = "Red")
),
dashboardBody(
fluidRow(
imageOutput("image"), # IMAGE TOO BIG AND BOX CANNOT COMPLETELY CONTAIN IT
),
fluidRow(
column(4,uiOutput("box1")),
column(4,uiOutput("box2")),
column(4,uiOutput("box3"))
),
fluidRow(
column(4,uiOutput("box4"))
),
tags$script("document.getElementsByClassName('sidebar-toggle')[0].style.visibility = 'hidden';")
)
)
server <- function(input, output) {
output$box1<-renderUI({
if("Red" %in% input$box)
box(
"Red",height = 300,width = 5
)
})
output$box2<-renderUI({
if("Green" %in% input$box)
box(
"Green",height = 300,width = 5
)
})
output$box3<-renderUI({
if("Blue" %in% input$box)
box(
"Blue",height = 300,width = 5
)
})
output$box4<-renderUI({
if("Yellow" %in% input$box)
box(
"Yellow",height = 300,width = 5
)
})
output$image <- renderImage({
filename <- normalizePath(file.path(paste0('www/', "connect-shopify-to-google-analytics", '.jpg')))
list(
src = filename,
height = 150,
width=1700
)
}, deleteFile = FALSE)
}
shinyApp(ui, server)
我解决了
div(style = "padding: 0px 0px; margin-top:-15em",fluidRow(
column(4,uiOutput("box1")),
column(4,uiOutput("box2")),
column(4,uiOutput("box3"))
我在下面的 shinydashboard
中几乎删除了页眉并在正文顶部添加了一个图像。在它下面有两排框问题是图像和 fluidRow()
之间有太多浪费的空白 space 正如您在 scrshot 中看到的那样。
## app.R ##
library(shiny)
library(shinydashboard)
library(shinyjs)
library(tableHTML)
ui <- dashboardPage(
dashboardHeader(titleWidth = 0,
tags$li(class = "dropdown",
tags$style(".main-header {max-height: 0px}"),
tags$style(".main-header .logo {height: 0px;}"),
tags$style(".sidebar-toggle {height: 0px; padding-top: 0px !important;}"),
tags$style(".navbar {min-height:0px !important}")
) ),
dashboardSidebar(
checkboxGroupInput("box", "Select box",
c("Red", "Green", "Blue", "Yellow"),selected = "Red")
),
dashboardBody(
fluidRow(
imageOutput("image"), # IMAGE TOO BIG AND BOX CANNOT COMPLETELY CONTAIN IT
),
fluidRow(
column(4,uiOutput("box1")),
column(4,uiOutput("box2")),
column(4,uiOutput("box3"))
),
fluidRow(
column(4,uiOutput("box4"))
),
tags$script("document.getElementsByClassName('sidebar-toggle')[0].style.visibility = 'hidden';")
)
)
server <- function(input, output) {
output$box1<-renderUI({
if("Red" %in% input$box)
box(
"Red",height = 300,width = 5
)
})
output$box2<-renderUI({
if("Green" %in% input$box)
box(
"Green",height = 300,width = 5
)
})
output$box3<-renderUI({
if("Blue" %in% input$box)
box(
"Blue",height = 300,width = 5
)
})
output$box4<-renderUI({
if("Yellow" %in% input$box)
box(
"Yellow",height = 300,width = 5
)
})
output$image <- renderImage({
filename <- normalizePath(file.path(paste0('www/', "connect-shopify-to-google-analytics", '.jpg')))
list(
src = filename,
height = 150,
width=1700
)
}, deleteFile = FALSE)
}
shinyApp(ui, server)
我解决了
div(style = "padding: 0px 0px; margin-top:-15em",fluidRow(
column(4,uiOutput("box1")),
column(4,uiOutput("box2")),
column(4,uiOutput("box3"))