Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Is there a way to disable "ggvis-dropdown-toggle" [SVG download option] #460

Open
bedantaguru opened this issue Jun 16, 2016 · 1 comment

Comments

@bedantaguru
Copy link

Thanks a lot for this nice package.
I was wondering whether it will be possible to disable the settings button [ggvis-dropdown-toggle or SVG download option button] through R.

I can do it while writing a shiny app like this
[example has been taken from here]
Trick is by adding this :

  tags$head(
    tags$style(HTML('a[class="ggvis-dropdown-toggle"]{display:none;}'))
  ),

Full code is

ui <- fluidPage(
  tags$head(
    tags$style(HTML('a[class="ggvis-dropdown-toggle"]{display:none;}'))
  ),
  sidebarLayout(
    sidebarPanel(
      sliderInput("n", "Number of points", min = 1, max = nrow(mtcars),
                  value = 10, step = 1),
      uiOutput("plot_ui")
    ),
    mainPanel(
      ggvisOutput("plot"),
      tableOutput("mtc_table")
    )
  ))


server <- function(input, output, session) {
  # A reactive subset of mtcars
  mtc <- reactive({ mtcars[1:input$n, ] })

  # A simple visualisation. In shiny apps, need to register observers
  # and tell shiny where to put the controls
  mtc %>%
    ggvis(~wt, ~mpg) %>%
    layer_points() %>%
    bind_shiny("plot", "plot_ui")

  output$mtc_table <- renderTable({
    mtc()[, c("wt", "mpg")]
  })
}


shinyApp(ui, server)

Kindly let me know.

@mienkoja
Copy link

This is a bit of a hack (and overwrites the css), but the following will get rid of the dropdown-toggle outside of shiny.

test <-
readLines("/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ggvis/www/ggvis/css/ggvis.css")
test[grep('a.ggvis-dropdown-toggle', test) + 1] <- "  display: 'none';"
writeLines(test, "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ggvis/www/ggvis/css/ggvis.css")

@wch, off the top of my head, an additional option might be nice here such that set_options(dropdown_toggle = TRUE) would display the toggle and set_options(dropdown_toggle = FALSE) would hide it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants