Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/69.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闪亮:修复流体页面列,例如使其不受滚动影响_R_Shiny - Fatal编程技术网

R闪亮:修复流体页面列,例如使其不受滚动影响

R闪亮:修复流体页面列,例如使其不受滚动影响,r,shiny,R,Shiny,我当前的Shining应用程序运行良好,但我使用的是流动页面环境: ui.R ---- shinyUI(fluidPage( fluidRow( column(3, ...long list of inserts... ), column(3, ... list of a few

我当前的Shining应用程序运行良好,但我使用的是流动页面环境:

    ui.R
    ----
    shinyUI(fluidPage(

     fluidRow(
              column(3,
                     ...long list of inserts...
                    ),

              column(3,
                     ... list of a few insterts...
                    ),

              column(6,
                     ... plot ...
                    )
      ))
现在,由于在第一列中有一个很长的插入列表,我想将绘图输出固定在适当的位置,因此它会随着屏幕向下滚动。
有什么想法吗?fluid page是否是错误的环境?

您可以使用Bootstrap的
数据间谍
指令和
粘贴
类:

library("shiny")
library("ggplot2")

server <- function(input, output, session) {
  output$plot <- renderPlot({
    ggplot(iris, aes(Sepal.Width, Sepal.Length)) + geom_point()
  })
}

long_list <- do.call(tagList, lapply(seq(50), function(ix) {
  id <- paste0("x", ix)
  numericInput(id, id, 1L)
}))

short_list <- do.call(tagList, lapply(seq(10), function(ix) {
  id <- paste0("y", ix)
  numericInput(id, id, 1L)
}))

ui <- fluidPage(
  tags$head(
    tags$style(HTML("

     .affix {
        top:50px;
        position:fixed;
      }

    "))
  )

  , fluidRow(
    column(3, long_list),
    column(3, short_list),
    column(6, div(`data-spy`="affix", `data-offset-top`="5", plotOutput("plot")))
  )
)

shinyApp(ui = ui, server = server)
库(“闪亮”)
图书馆(“ggplot2”)

服务器我不熟悉Shiny/R,但我认为您也可以使用
fixedPanel
:)

这是一个经过编辑的MLEGE代码版本,使用
fixedPanel
:)

库(“闪亮”)
图书馆(“ggplot2”)

谢谢!对我来说也很好,特别是在适当设置宽度的情况下。我甚至可以放下顶部和右侧的一个非常好的自动配置为各种窗口大小。有多种方法来解决这个问题是很好的。
library("shiny")
library("ggplot2")

server <- function(input, output, session) {
    output$plot <- renderPlot({
        ggplot(iris, aes(Sepal.Width, Sepal.Length)) + geom_point()
    })
}

long_list <- do.call(tagList, lapply(seq(50), function(ix) {
    id <- paste0("x", ix)
    numericInput(id, id, 1L)
}))

short_list <- do.call(tagList, lapply(seq(10), function(ix) {
    id <- paste0("y", ix)
    numericInput(id, id, 1L)
}))

ui <- fluidPage(
    fluidRow(
        column(3, long_list),
        column(3, short_list),
        column(6, fixedPanel(top = 10, right = 10, width = "45%", plotOutput("plot")))
    )
)

shinyApp(ui = ui, server = server)