使用Shiny,有人知道如何创建一个UI界面,其中包含一个主面板(中间)和两个侧面板(左侧和右侧),每个面板都有自己的水平和垂直滚动条吗?
您可以使用fluidRow
和column
,这是一个例子。您可以调整列宽,只要总和为12即可。
library(shiny)
ui <- shinyUI(fluidPage(
titlePanel("Old Faithful Geyser Data"),
fluidRow(
column(2,
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30),
style="overflow-x: scroll; overflow-y: scroll"),
column(8,
plotOutput("distPlot")),
column(2,
textInput("test", "Test"),
style="overflow-x: scroll; overflow-y: scroll")
)
))
server <- shinyServer(function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
})
shinyApp(ui = ui, server = server)
height: 400px;
。 - Xiongbing Jin