R highcharter 添加多个带有形状的注释

R highcharter add multiple annotations with shapes

我想在 Highcharter 中添加带有形状的注释

这是我的数据

data <- data.frame(a=c(1:12), b=runif(12, 1, 100))

I want to do this 列带有一些注释形状 columns with multiple annotations shapes

我已经参考了 and

但我还是做不到,这是我的示例代码

library(highcharter)

hc <- highchart() %>%
  hc_add_series(data, type='column', hcaes(a,b), marker=list(enabled=FALSE))
hc %>% 
  hc_annotations(
    list(
      shapes = list(
        list(
          point = list(
            x = data$a[5],
            y = data$b[5],
            xAxis = 0,
            yAxis = 0
          ),
          type = 'circle'
        )
      )
    )
  )

感谢您考虑我的请求!

试一试:

library(highcharter)
data <- data.frame(a=c(1:12), b=runif(12, 1, 100))
hc <- highchart() %>%
  hc_add_series(data, type='column', hcaes(a,b), marker=list(enabled=FALSE))
hc<-hc%>% 
  hc_add_annotation( 
    labels = list(
      list(
        point = list(
          xAxis =0 ,
          yAxis =0 ,
          x =data$a[5],
          y = data$b[5],
          xAxis=0,
          yAxis=0     
        ),
        text = "Is it OK?"
      )
    )
  )

hc%>% 
  hc_add_annotation(
    shapes=list(
      list(
      point=list(
      x=data$a[5],
      y=data$b[5],
      xAxis=0,
      yAxis=0),
      type= 'circle',
      r=10)))