Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 当添加css“style=position:fixed;”时,侧边栏面板收缩_R_Shiny - Fatal编程技术网

R 当添加css“style=position:fixed;”时,侧边栏面板收缩

R 当添加css“style=position:fixed;”时,侧边栏面板收缩,r,shiny,R,Shiny,我需要一个固定的侧边栏面板,但是当addstyle='position:fixed;'时,我遇到了问题。添加样式时,侧边栏面板会收缩。 样式为'position:fixed;'的代码在下面此图显示了不带和带有样式='position:fixed;'我怎样才能使sibarPanel不收缩 # User interface ui <- fluidPage( sidebarLayout( sidebarPanel(width = 2, style=

我需要一个固定的侧边栏面板,但是当addstyle='position:fixed;'时,我遇到了问题。添加样式时,侧边栏面板会收缩。 样式为'position:fixed;'的代码在下面此图显示了不带和带有样式='position:fixed;'我怎样才能使sibarPanel不收缩

# 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)

我认为这是一种方式:

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)