Change the data displayed on the chart.

change_data(proxy, data, ..., figures = NULL)

Arguments

proxy

A g2r proxy as returned by g2Proxy

data

A data.frame or tibble

...

Bare names of column to select.

figures

Index of figures to apply the change to.

Note

The variable names must be identical to the initial data.

Examples

library(shiny) .make_data <- function(){ dplyr::tibble( x = 1:20, y = runif(20) ) } ui <- fluidPage( fluidRow( column(10, g2Output("chart")), column(2, actionButton("chg", "chg")) ) ) server <- function(input, output, session) { output$chart <- renderG2({ g2(.make_data(), asp(x, y)) %>% fig_point() }) observeEvent(input$chg, { g2Proxy("chart") %>% change_data(.make_data(), x, y) }) }
# NOT RUN { shinyApp(ui, server) # }