library(shiny)
ui <- fluidPage(
actionButton("rm", "Remove z serie"),
echarts4rOutput("plot")
)
server <- function(input, output, session) {
data <- data.frame(
x = rnorm(10, 5, 3),
y = rnorm(10, 50, 12),
z = rnorm(10, 50, 5)
)
output$plot <- renderEcharts4r({
data |>
e_charts(x) |>
e_scatter(y) |>
e_scatter(z)
})
observeEvent(input$rm, {
echarts4rProxy("plot") |>
e_remove_serie_p(serie_name = "z")
})
}
if (FALSE) {
shinyApp(ui, server)
}
Run the code above in your browser using DataLab