Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/74.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
Css 停止shinydashboardPlus中的右侧边栏隐藏应用程序的主体_Css_R_Shiny_Shinydashboard - Fatal编程技术网

Css 停止shinydashboardPlus中的右侧边栏隐藏应用程序的主体

Css 停止shinydashboardPlus中的右侧边栏隐藏应用程序的主体,css,r,shiny,shinydashboard,Css,R,Shiny,Shinydashboard,是否可以停止shinydashboardPlus中隐藏应用程序主体部分的右侧边栏 常规左侧边栏面板的默认行为是不隐藏应用程序主体的任何部分。例如,在下面的中,单击左侧边栏,并将绘图移到右侧(您可以看到绘图的所有部分) 单击右侧边栏面板时,此行为不会发生(请参见下面的屏幕截图) 单击侧边栏,绘图部分被面板隐藏。如何停止此行为并使其在单击后向左移动/重新缩放以适合主体,从而不隐藏部分绘图 示例代码 库(闪亮) 图书馆(shinydashboard) 图书馆(shinydashboardPlus)

是否可以停止
shinydashboardPlus
中隐藏应用程序主体部分的右侧边栏

常规左侧边栏面板的默认行为是不隐藏应用程序主体的任何部分。例如,在下面的中,单击左侧边栏,并将绘图移到右侧(您可以看到绘图的所有部分)

单击右侧边栏面板时,此行为不会发生(请参见下面的屏幕截图)

单击侧边栏,绘图部分被面板隐藏。如何停止此行为并使其在单击后向左移动/重新缩放以适合主体,从而不隐藏部分绘图

示例代码

库(闪亮)
图书馆(shinydashboard)
图书馆(shinydashboardPlus)
数据(iris)

页眉第一个问题是,如果希望调整大小,则
plotOutput
的固定宽度不应为700px

第二个问题是,单击右侧边栏不会触发
shinydashboard
左侧边栏的调整大小事件(与此问题相同)。我通过JS修复了它:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
data(iris)

header <- dashboardHeaderPlus(enable_rightsidebar = TRUE,
                              rightSidebarIcon = "filter")

sidebar <- dashboardSidebar(
  selectInput(
    inputId = "slect",
    label = "Selection Menu",
    selected = "a",
    choices = LETTERS[1:3]
  )
)

body <- dashboardBody(
  tags$script('
      $(".navbar-custom-menu").on("click",function(){
        $(window).trigger("resize");
      })'
  ),
  fluidPage(
    plotOutput(
      "scatter",
      height = "700px",
      width = "100%"
    )
  ))

rightsidebar <- rightSidebar()

ui <- dashboardPagePlus(header,
                        sidebar,
                        body,
                        rightsidebar)

server <- function(input, output) {
  output$scatter <- renderPlot({
    plot(iris$Petal.Length, iris$Petal.Width, pch = 21)
    cats <- levels(iris$Species)
    cols <- c("red", "blue", "yellow2")
    ind <- lapply(cats, function(z)
      which(iris$Species == z))
    for (i in seq(cats)) {
      points(iris$Petal.Length[ind[[i]]],
             iris$Petal.Width[ind[[i]]],
             pch = 19,
             col = cols[i])
    }
  })
}

shinyApp(ui, server)
库(闪亮)
图书馆(shinydashboard)
图书馆(shinydashboardPlus)
数据(iris)

header我提出了一个关于缺少调整大小事件的问题。这很有效,我唯一的轻微问题是在点击按钮后调整大小有点慢。感谢您在Github上打开一期!现在它已经在开发版本中了:
devtools::install\u github(“RinteRface/shinydashboardPlus”)
因此不再需要我的解决方法。然而,仍有轻微的延误。调整浏览器窗口大小时也会出现此延迟-调整绘图大小似乎需要一些时间。您可以找到一些关于调整大小的附加信息。