'Series disappears with highchartProxy in R shiny
I'm testing the new proxy function in the highcharter-library (0.9.4 using R 4.1.3). I don't get any error, but the serie disappears. However, something seems to go wrong in highcharts.js.
I used the code below. Can anyone see what I'm doing wrong?
library(shiny)
library(highcharter)
library(dplyr)
df <- faithful %>%
mutate(id = row_number())
ui <- fluidPage(
highchartOutput("bar")
, selectInput("id_bar", label = "select id", choices = df$id)
)
server <- function(input, output) {
# inital chart
output$bar <- renderHighchart({
df_bar <- df %>% filter(id == 1)
hc <- highchart() %>%
hc_add_series(df_bar, type = "bar", hcaes(y = eruptions), id = "serie1")
hc
})
# update chart
observeEvent(input$id_bar, {
df_update <- df %>% filter(id == input$id_bar)
highchartProxy("bar") %>%
hcpxy_update_series(id = "serie1", data = df_update, type = "bar", hcaes(y = eruptions))
})
}
shinyApp(ui = ui, server = server)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
