Append data.

e_append1_p(proxy, series.index = NULL, data, x, y)

e_append2_p(proxy, series.index = NULL, data, x, y, z)

Arguments

proxy

An echarts4r proxy as returned by echarts4rProxy.

series.index

Index of serie to append to (starts from 0).

data

Data.frame containing data to append.

x, y, z

Columns names to plot.

Details

Currently not all types of series supported incremental rendering when using appendData. Only these types of series support it: e_scatter and e_line of pure echarts, and e_scatter_3d, and e_line_3d of echarts-gl.

Examples

# NOT RUN {
  library(shiny)

  ui <- fluidPage(
    actionButton("add", "Add Data to y"),
    echarts4rOutput("plot"),
    h4("Brush"),
    verbatimTextOutput("selected"),
    h4("Legend select change"),
    verbatimTextOutput("legend")
  )

  server <- function(input, output, session){

    data <- data.frame(x = rnorm(10, 5, 3), y = rnorm(10, 50, 12), z = rnorm(10, 50, 5))

    react <- eventReactive(input$add, {
      set.seed(sample(1:1000, 1))
      data.frame(x = rnorm(10, 5, 2), y = rnorm(10, 50, 10))
    })

    output$plot <- renderEcharts4r({
      data %>%
       e_charts(x) %>%
       e_scatter(y) %>%
       e_scatter(z) %>%
       e_brush(throttleType = "debounce")
    })

    observeEvent(input$add, {
      echarts4rProxy("plot") %>%
        e_append1_p(0, react(), x, y)
    })

    output$selected <- renderPrint({
      input$plot_brush
    })

    output$legend <- renderPrint({
      input$plot_legend_change
    })

  }

  shinyApp(ui, server)

# }