score:1

Accepted answer

highcharter likes a timestamp when you use dates like this. try using the datetime_to_timestamp function as below and include text in your list along with point.

library(highcharter)

df <- data.frame(
  x = seq(as.date("2021-01-01"),as.date("2021-01-10"),by = "days"),
  y = 1:10
)

hchart(df, "line", hcaes(x = x, y = y))  %>%
  hc_annotations(
    list(
      labels = lapply(1:nrow(df),function(i){
        list(
          point = list(
            x = datetime_to_timestamp(df$x[i]),
            y = df$y[i],
            xaxis = 0,
            yaxis = 0
            ),
          text = as.character(df$y[i])
          )
      })
    )
  )

Related Query

More Query from same tag