2016-11-21 17 views
4

Я создал всплывающее окно с функцией popify из пакета shinyBS в блестящем виде. Я хочу, чтобы всплывающее окно в нижней части моего фильтра было таким же широким, как и мой фильтр. Я не могу найти ничего в документации об этом. скриншот: Screenshot of the pop-up Пример кода:Увеличение ширины всплывающего окна от shinyBS в блестящем

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)) 

    } 
) 
+0

Должно быть выполнимо с помощью опции шаблона: http://getbootstrap.com/javascript/#tooltips-options, но я считаю, что это Безразлично» t работать с опциями в 'popify', поэтому, возможно, стоит написать вопрос о github. – Carl

ответ

4

Вы можете попробовать добавить некоторые CSS, чтобы сделать это.

В вашей боковой панели можно добавить:

tags$style(".popover{ 
      max-width: 100%; 
      }") 

Если это не достаточно большой, то вы можете добавить options=list(container="body") в вашем popify сделать body держателя, который позволяет всплывающий быть столь же большим, как страницы ,

Существует подробнее here, я приспособился, что ответ на R.

+0

спасибо! работает как шарм :) –