Closed DivadNojnarg closed 5 years ago
Thanks for reporting that David! I just pushed a fix. Note that to do what you are after there is a proxy (below) which changes the underlying data which is faster as it doesn't redraw everything (i.e.: axes) and makes the animation much better.
library(shiny)
library(g2r)
shinyApp(
ui = fluidPage(
sliderInput(
inputId = "obs",
label = "Number of rows:",
min = 1,
max = nrow(cars),
value = 10,
step = 1
),
g2Output("chart")
),
server = function(input, output) {
output$chart <- renderG2({
g2(cars, asp(speed, dist)) %>%
fig_point() %>%
fig_smooth(method = "loess") %>%
motif_dark()
})
observeEvent(input$obs, {
g2Proxy("chart") %>%
change_data(cars[1:input$obs, ], speed, dist)
})
}
)
Cool!
As discussed before: