# NOT RUN {
library(shiny)
ui <- fluidPage(
fluidRow(
column(8, echarts4rOutput("chart")),
column(4, actionButton("zoom", "Zoom"))
)
)
server <- function(input, output, session) {
output$chart <- renderEcharts4r({
cars %>%
e_charts(speed) %>%
e_scatter(dist) %>%
e_datazoom()
})
observe({
req(input$zoom)
echarts4rProxy("chart") %>%
e_dispatch_action_p("dataZoom", startValue = 1, endValue = 10)
})
}
if (interactive()) {
shinyApp(ui, server)
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab