删除 Highcharter 图中的标志图例

Remove flag legend in Highcharter graph

如何删除下图中的 "Series 2"?文档指向 https://api.highcharts.com/highcharts/plotOptions.flags 。但是,我找不到如何将附加选项添加到“...”的示例。

library("quantmod")
library("highcharter")

usdjpy <- getSymbols("USD/JPY", src="oanda", auto.assign = FALSE)

dates <- as.Date(c("2018-01-08", "2018-01-12"), format = "%Y-%m-%d")
highchart(type = "stock") %>% 
  hc_add_series(usdjpy, id = "usdjpy") %>% 
  hc_add_series_flags(dates,
                      title = c("E1", "E2"), 
                      text = c("This is event 1", "This is the event 2"),
                      id = "usdjpy") %>% 
  hc_legend(enabled = T)

只需添加参数 showInLegend = F:

highchart(type = "stock") %>% 
  hc_add_series(usdjpy, id = "usdjpy") %>% 
  hc_add_series_flags(dates,
                      title = c("E1", "E2"), 
                      text = c("This is event 1", "This is the event 2"),
                      id = "usdjpy", showInLegend = F) %>% 
  hc_legend(enabled = T)

更多信息:https://api.highcharts.com/highcharts/series.line.showInLegend