我已经创建了一个 Shiny 的应用程序,并且我渲染到 UI 的选项卡之间没有额外的间距。我正在使用 bs4dash Shiny 的 UI 框架。这个问题和这个框架有关吗?
code :
tabsetPanel(type = "tabs",
tabPanel(title = "abc",
rHandsontableOutput("contentsl"),tags$style(type="text/css", "#contentsl th {font-weight:bold;}")),
tabPanel(title = "fgh",
rHandsontableOutput("content1"),tags$style(type="text/css", "#content1 th {font-weight:bold;}")),
tabPanel(title = "hjk",
rHandsontableOutput("content2"),tags$style(type="text/css", "#content2 th {font-weight:bold;}")),
tabPanel(title="pqr",rHandsontableOutput("prem"),tags$style(type="text/css", "#prem th {font-weight:bold;}")),
tabPanel(title="Scatter Plot View",plotlyOutput("pl9",width = "100%",height = "600px")),
tabPanel(title = "Box Plot View",plotlyOutput("pl8",width = "100%",height = "600px")),
tabPanel(title = "Plot Data",rHandsontableOutput("pl.data",width = "100%",height = "100%"),tags$style(type="text/css","#pl.data th {font-weight:bold;}"))
))
最佳答案
如果我在基本的 Shiny 应用程序(自动创建)中实现你的代码,它对我来说效果很好。这是代码(这并不是真正的答案,但它不适合评论,所以如果它没用,我将删除它):
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
library(rhandsontable)
library(plotly)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
tabsetPanel(
type = "tabs",
tabPanel(
title = "abc",
rHandsontableOutput("contentsl"),
tags$style(type = "text/css", "#contentsl th {font-weight:bold;}")
),
tabPanel(
title = "fgh",
rHandsontableOutput("content1"),
tags$style(type = "text/css", "#content1 th {font-weight:bold;}")
),
tabPanel(
title = "hjk",
rHandsontableOutput("content2"),
tags$style(type = "text/css", "#content2 th {font-weight:bold;}")
),
tabPanel(
title = "pqr",
rHandsontableOutput("prem"),
tags$style(type = "text/css", "#prem th {font-weight:bold;}")
),
tabPanel(title = "Scatter Plot View", plotlyOutput(
"pl9", width = "100%", height = "600px"
)),
tabPanel(title = "Box Plot View", plotlyOutput(
"pl8", width = "100%", height = "600px"
)),
tabPanel(
title = "Plot Data",
rHandsontableOutput("pl.data", width = "100%", height = "100%"),
tags$style(type = "text/css", "#pl.data th {font-weight:bold;}")
)
)
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
# Run the application
shinyApp(ui = ui, server = server)
关于r - Shiny 的应用程序中选项卡名称之间没有空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58918650/