Description Usage Arguments Examples
Proxy to dynamically interact with the chart in shiny.
1 |
id |
Id of chart to interact with. |
... |
Aspects, see |
data |
Data.frame containing data to plot. |
session |
A valid shiny session. |
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 | library(shiny)
dataset <- data.frame(x = 1:100, y = runif(100, 1, 100))
ui <- fluidPage(
g2Output("plot"),
actionButton("add", "Add figure")
)
server <- function(input, output, session) {
output$plot <- renderG2({
g2(dataset, asp(x, y)) %>%
fig_point()
})
observeEvent(input$add, {
df <- data.frame(x = 1:100, y = runif(100, 1, 100))
g2_proxy("plot", data = df) %>%
fig_point(asp(x, y)) %>%
render()
})
}
if (interactive()) {
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.