dreamRs / esquisse

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

label-background invisible in shinydashboard #36

Closed qfazille closed 5 years ago

qfazille commented 6 years ago

Thanks for this great package !

On the minimal example herebelow I've got the labels X, Y, Fill, etc... invisible. Toying with css property z-index on the class label-background can make them appear but I didn't find a correct solutions (because they get above variables label).

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(
        tabItems(
            tabItem(tabName = "dataset",
                fluidRow(
                    box(radioButtons("RB_dataset", label = "Choose dataset", choices = c("iris", "mtcars"), selected = "iris"))
                )
            ),

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

server <- function(input, output) {
    iris$VERYVERYVERYLONGNAME <- 1
    mtcars$VERYVERYVERYLONGNAME <- 1
    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)
        }
    })
}

shinyApp(ui, server)
pvictor commented 5 years ago

Hi Quentin, That was a hard one, I replace labels as text and CSS by base64 encoded SVG as background. This should do the trick, please re-install from GitHub.

If it works for you, you owe me a beer, @davidgohel agreed.

Thanks,

Victor

qfazille commented 5 years ago

Hi ! it works fine, thank you. Ok for the :beer:

pvictor commented 5 years ago

👍 😄 Top!