Thanks a lot for this wonderful package!
In append.R function e_append1_p()
e_append1_p_ <- function(proxy, series_index = NULL, data, x, y, name = NULL) {
...
dlist <- data |>
dplyr::select(x, y,name) |>
...
the name in e_append1_p is not in the right place, I think, because it assumes that the input data always has a column called name, regardless of whether the argument name is NULL. Therefore, when dplyr::select() tries to select name, it throws an error: "Can't subset columns that don't exist."
I get around the problem by adding a column name to the data-to-append like in this code:
library(shiny)
library(echarts4r)
ui <- fluidPage(
actionButton("append", "Append data pairs"),
echarts4rOutput("plot")
)
server <- function(input, output, session) {
# start with one point
base <- data.frame(x = c(4, 3), y = c(4, 3))
output$plot <- renderEcharts4r({
base |>
e_charts(x, reorder = FALSE) |>
e_line(y, name = "path", showSymbol = FALSE) |>
e_animation(show = FALSE)
})
new <- data.frame(x = c(2, 1), y = c(2, 1), name = "bug")
observeEvent(input$append, {
echarts4rProxy("plot") |>
e_append1_p(series_index = 0, data = new, x = "x", y = "y", name = "path")
})
}
shinyApp(ui, server)
However, the new data is not appended, but replaces the previous data.
BTW: the argument reorder = FALSE is missing in the help files.
Thanks a lot for this wonderful package!
In append.R function e_append1_p()
the
nameine_append1_pis not in the right place, I think, because it assumes that the inputdataalways has a column calledname, regardless of whether the argumentnameisNULL. Therefore, whendplyr::select()tries to selectname, it throws an error: "Can't subset columns that don't exist."I get around the problem by adding a column
nameto the data-to-append like in this code:However, the
newdata is not appended, but replaces the previous data.BTW: the argument
reorder = FALSEis missing in the help files.