在Highcharter图表中删除标志图例

时间:2018-04-17 17:35:14

标签: r highcharts r-highcharter

如何删除下图中的“系列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)

1 个答案:

答案 0 :(得分:1)

只需添加参数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