convert: Convert

Description Usage Arguments Examples

Description

Convert chart to a dataURL or an image.

Usage

1
2
3
to_dataURL(proxy)

download_image(proxy, name = "g2r")

Arguments

proxy

A g2r proxy as returned by g2Proxy

name

Name of file.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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)

JohnCoene/g2r documentation built on March 6, 2021, 8:11 p.m.