我需要有一个固定的sidebarPanel,但是添加style = 'position: fixed;'
时遇到问题。当我添加样式时,sidebarPanel会缩小。
下面的代码(带有style = 'position: fixed;'
)。该图像显示了不使用style = 'position: fixed;'
和不使用# User interface
ui <- fluidPage(
sidebarLayout(
sidebarPanel(width = 2,
style='position: fixed;',
uiOutput("countryList")),
mainPanel(
plotOutput("distPlot1"),
plotOutput("distPlot2"),
plotOutput("distPlot3"))))
# Server logic
server <- function(input, output) {
output$countryList <- renderUI({
selectizeInput("countryName", "Country",
choices = c('Austria', 'The United Kingdom'))})
output$distPlot1 <- renderPlot({hist(rnorm(100))})
output$distPlot2 <- renderPlot({hist(rnorm(200))})
output$distPlot3 <- renderPlot({hist(rnorm(300))})}
shinyApp(ui, server)
的结果,如何使sibarPanel不收缩?
typeof(IMyInterface).IsAssignableFrom(p.PropertyType)
答案 0 :(得分:1)
我认为是这样的:
library(shiny)
# User interface
ui <- fluidPage(
div(class = "row",
div(class = "col-sm-4",
tags$form(class = "well col-sm-4", `data-spy` = "affix", # this is the sidebar
uiOutput("countryList")
)
),
div(class = "col-sm-8", # this is the main panel
plotOutput("distPlot1"),
plotOutput("distPlot2"),
plotOutput("distPlot3")
)
)
)
# Server logic
server <- function(input, output) {
output$countryList <- renderUI({
selectizeInput("countryName", "Country",
choices = c('Austria', 'The United Kingdom'))})
output$distPlot1 <- renderPlot({hist(rnorm(100))})
output$distPlot2 <- renderPlot({hist(rnorm(200))})
output$distPlot3 <- renderPlot({hist(rnorm(300))})}
shinyApp(ui, server)