【发布时间】:2017-03-18 00:05:17
【问题描述】:
我正在尝试创建一个使用 tabsetPanel 的闪亮应用程序,但是当我创建选项卡时,应用程序中的内容不再填满窗口的整个空间,并且在输出的右侧和下方留下大的白色间隙。下面是一个非常基本的例子。如果没有标签,该应用程序可以完美地作为一个流畅的页面工作,但对于我正在做的工作,我需要将它拆分为标签。
一个简单的例子:
`library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
mainPanel(
tabsetPanel(
tabPanel("Test",
# 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(
plotOutput("distPlot")
)
)),
#Create second tab just for demonstration
tabPanel("Second Test", h3("Test")
))))
# 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')
})
{ "example second tab" }
}
# Run the application
shinyApp(ui = ui, server = server) `
我试图摆弄fillPage 和fluidPage,但要么将对象移动到错误的位置而使情况变得更糟,要么根本没有任何反应。难道只有我会发生这种情况吗?有谁知道它这样做的原因是什么,如果是这样,如何解决?
【问题讨论】:
-
如果你想调整tabset面板的宽度和高度,这篇帖子可能会有所帮助:stackoverflow.com/questions/19096439/…