Description Usage Arguments Note Examples
Change the data displayed on the chart.
1 | change_data(proxy, data, ..., figures = NULL)
|
proxy |
A g2r proxy as returned by |
data |
A data.frame or |
... |
Bare names of column to select. |
figures |
Index of figures to apply the change to. |
The variable names must be identical to the initial data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.