首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从shinyBS增加popify弹出的宽度

从shinyBS增加popify弹出的宽度
EN

Stack Overflow用户
提问于 2016-11-21 14:36:27
回答 1查看 2.6K关注 0票数 4

我在popify包中创建了一个弹出式的shinyBS函数。我想在我的过滤器底部弹出一个和我的过滤器一样宽的。我在这方面的文档里找不到任何东西。

截图:

示例代码:

代码语言:javascript
复制
library(shiny)
library(shinyBS)

shinyApp(
  ui =
    fluidPage(
      sidebarLayout(
        sidebarPanel(
          tags$span(
            popify(
          sliderInput("bins",
                      "Number of bins:",
                      min = 1,
                      max = 50,
                      value = 30),
          'a very long popup',"1. I want everything behind 1 on one line and everything that starts after<br> 2. I want to see on the second line without wrapping it to the 3rd line.")),
          actionButton("tabBut", "View Table")
        ),

        mainPanel(
          plotOutput("distPlot"),
          bsModal("modalExample", "Data Table", "tabBut", size = "large",
                  dataTableOutput("distTable"))
        )
      )
    ),
  server =
    function(input, output, session) {

      output$distPlot <- renderPlot({

        x    <- faithful[, 2]
        bins <- seq(min(x), max(x), length.out = input$bins + 1)

        # draw the histogram with the specified number of bins
        hist(x, breaks = bins, col = 'darkgray', border = 'white')

      })

      output$distTable <- renderDataTable({

        x    <- faithful[, 2]
        bins <- seq(min(x), max(x), length.out = input$bins + 1)

        # draw the histogram with the specified number of bins
        tab <- hist(x, breaks = bins, plot = FALSE)
        tab$breaks <- sapply(seq(length(tab$breaks) - 1), function(i) {
          paste0(signif(tab$breaks[i], 3), "-", signif(tab$breaks[i+1], 3))
        })
        tab <- as.data.frame(do.call(cbind, tab))
        colnames(tab) <- c("Bins", "Counts", "Density")
        return(tab[, 1:3])

      }, options = list(pageLength=10))

    }
)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-02 16:13:58

您可以尝试添加一些CSS来做到这一点。

在侧边栏面板中,您可以添加:

代码语言:javascript
复制
tags$style(".popover{
            max-width: 100%;
          }")

如果这还不够大,您可以在您的popify中添加popify,使body成为允许弹出窗口与页面一样大的保持器。

还有更多的信息,here,我把这个答案改编成R。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40722672

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档