我必须在sidebarPanel中添加更多滑块,但是当我向下滚动页面时, 整个页面与mainPanel一起向下滚动。我需要的是,当我向下滚动输入滑块并更改滑块以观察Shiny中主面板上的相应输出时,必须以这种方式锁定或冻结显示图形或输出的mainPanel。
以下是ui.R的部分代码。这里我只显示了7个滑块,但实际上我有31个滑块。
library(shiny)
shinyServer(fluidPage(
titlePanel("Regression"),
sidebarLayout(
sidebarPanel(
sliderInput("slide1","Select a value:",
min=min(unidf$X.17,na.rm = T),max=max(unidf$X.17,na.rm = T), value = median(unidf$X.17,na.rm = T)),
sliderInput("slide2","Head HIC-15:",
min=min(unidf$X.18,na.rm = T),max=max(unidf$X.18,na.rm = T), value = median(unidf$X.18,na.rm = T)),
sliderInput("slide3","Select a value:",
min=min(unidf$X.19,na.rm = T),max=max(unidf$X.19,na.rm = T), value = median(unidf$X.19,na.rm = T)),
sliderInput("slide4","Select a value:",
min=min(unidf$X.20,na.rm = T),max=max(unidf$X.20,na.rm = T), value = median(unidf$X.20,na.rm = T)),
sliderInput("slide5","Lateral force (kN):",
min=min(unidf$X.21,na.rm = T),max=max(unidf$X.21,na.rm = T), value = median(unidf$X.21,na.rm = T)),
sliderInput("slide6","Select a value:",
min=min(unidf$X.22,na.rm = T),max=max(unidf$X.22,na.rm = T), value = median(unidf$X.22,na.rm = T)),
sliderInput("slide7","Average deflection (mm):",
min=min(unidf$X.23,na.rm = T),max=max(unidf$X.23,na.rm = T), value = median(unidf$X.23,na.rm = T))
),
mainPanel(...
答案 0 :(得分:1)
dashboardSidebar(
tags$head(
tags$style(HTML("
.sidebar { height: 90vh; overflow-y: auto; }
" )
)
),
... ...
我希望它可以帮到你。