# NOT RUN {
library(shiny)
ui <- fluidPage(
actionButton("dl", "download"),
g2Output("chart")
)
server <- function(input, output) {
output$chart <- renderG2({
g2(cars, asp(speed, dist)) %>%
fig_point()
})
observeEvent(input$dl, {
g2Proxy("chart") %>%
download_image()
})
}
# }
# NOT RUN {
shinyApp(ui, server)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab