Is there a way to disable "ggvis-dropdown-toggle" [SVG download option]
bedantaguru opened this issue · 1 comments
bedantaguru commented
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 commented
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.