SidebarPanel сжимается при добавлении CSS "style = position: fixed;" - PullRequest
0 голосов
/ 01 июля 2019

Мне нужно иметь фиксированную боковую панель, но у меня возникают проблемы при добавлении style = 'position: fixed;'.Когда я добавляю стиль, боковая панель панели сжимается.Код (с style = 'position: fixed;') ниже.На рисунке показан результат без и с style = '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)

imagestyle = 'position: fixed;'">

1 Ответ

1 голос
/ 01 июля 2019

Я думаю, что это путь:

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)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...