dreamRs / esquisse

RStudio add-in to make plots interactively with ggplot2
https://dreamrs.github.io/esquisse
Other
1.77k stars 229 forks source link

scrollbar hidden in shinydashboard #39

Closed qfazille closed 3 years ago

qfazille commented 5 years ago

Hi Victor,

Sorry to come back with a new shinydashboard related issue.

On the example I get the css property below when using esquisse modules :

html, body {
  overflow: hidden;
}

I'm not even sure that's coming from esquisse but it behaves well without... :confused:

library(shiny)
library(shinydashboard)
library(esquisse)

ui <- dashboardPage(
    dashboardHeader(title = "Equisse in shinydashboard", titleWidth = "300"),
    dashboardSidebar(
        sidebarMenu(id = "tabs",
                    menuItem("Dataset", tabName = "dataset", icon = icon("database")),
                    menuItem("Esquisse", tabName = "esquisse", icon = icon("line-chart"))
        )
    ),
    dashboardBody(
        # My dirty workaround :)
        #HTML("<script>
        #          document.getElementsByTagName('html')[0].style.overflow = 'auto';
        #      </script>"),
        tabItems(
            tabItem(tabName = "dataset",
                    fluidRow(
                        box(radioButtons("RB_dataset", label = "Choose dataset", choices = c("iris", "mtcars"), selected = "iris"))
                    )
                    ,fluidRow(
                        box(uiOutput("very_long_text"))
                    )
            ),

            tabItem(tabName = "esquisse",
                    fluidRow(
                        box(title = "Create my plot", status = "success", solidHeader = FALSE, collapsible = FALSE, collapsed = FALSE, width=12,
                            style = "height: 400px;"
                            ,esquisserUI(
                                id = "graph",
                                header = FALSE,
                                choose_data = FALSE
                            )
                        )
                        ,box(uiOutput("very_long_text2"))
                    )
            )
        )
    )
)

server <- function(input, output) {
    graph_param <- reactiveValues(data = NULL, name = NULL)
    observe({
        if (input$RB_dataset == "iris") {
            graph_param$data <- iris
            graph_param$name <- "iris"
        } else {
            graph_param$data <- mtcars
            graph_param$name <- "mtcars"
        }
    })
    observeEvent(input$tabs, {
        if (input$tabs == "esquisse") {
            callModule(module = esquisserServer, id = "graph", data = graph_param)
        }
    })
    output$very_long_text <- renderUI({
        HTML(paste(rep(paste(letters, collapse = ""), 100), collapse = "<br/>"))
    })
    output$very_long_text2 <- renderUI({
        HTML(paste(rep(paste(letters, collapse = ""), 100), collapse = "<br/>"))
    })

}

shinyApp(ui, server)
pvictor commented 5 years ago

Hello Quentin, First, constructive feedback is always appreciated. Second, one issue = one beer, so feel free to open as many as you want, we'll do the count with @davidgohel in early january.

The problem is that the module uses shiny::fillPage to fit the height of the container, and it's not intended to be used in another application...

Quick work around (in CSS), add anywhere this:

tags$style("html, body {overflow: visible !important;")

I'll think of something better and keep you posted.

Victor

davidgohel commented 5 years ago

@qfazille, just to be clear, it is one issue = one beer for @pvictor and one beer for me

qfazille commented 5 years ago

Thanks Victor for answer. Good to know it's coming from shiny::fillPage.
I'll keep my dirty js workaround.

Sounds fair for a couple of :beers: !

jokedurnez commented 5 years ago

Ran into this issue as well, and the fix worked. Thanks !