Export a Billboard to PNG
Export a Billboard to PNG
bb_export(bb, filename = NULL, download_label = "Export (.png)", ...)
bb |
A |
filename |
A string of the filename, excluding extension (will be |
download_label |
Label to appear on the link to download PNG. |
... |
Additional arguments (not used). |
A billboard
htmlwidget
object.
This function has two uses:
in shiny: you can export to PNG with an observeEvent
by using billboarderProxy
.
in markdown and in shiny: add a button to download chart as PNG.
# Add a button to download as PNG: data("equilibre_mensuel") billboarder() %>% bb_linechart( data = equilibre_mensuel, mapping = bbaes(date, solde), type = "spline" ) %>% bb_x_axis( tick = list(format = "%Y-%m", fit = FALSE) ) %>% bb_export( filename = "my-awesome-chart", download_label = "Click to download" ) # In shiny, you can use proxy : if (interactive()) { library(shiny) library(billboarder) ui <- fluidPage( fluidRow( column( width = 8, offset = 2, tags$h1("Export billboard as PNG via Proxy"), billboarderOutput(outputId = "mybb"), actionButton( inputId = "export", label = "Export", icon = icon("download") ) ) ) ) server <- function(input, output, session) { output$mybb <- renderBillboarder({ data("prod_par_filiere") billboarder() %>% bb_barchart( data = prod_par_filiere[, c("annee", "prod_hydraulique")], color = "#102246" ) %>% bb_y_grid(show = TRUE) }) observeEvent(input$export, { billboarderProxy(shinyId = "mybb") %>% bb_export(filename = "my-billboard-chart") }) } shinyApp(ui, server) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.