MLEN
MLEN

Reputation: 2561

Remove flag legend in Highcharter graph

How can I remove "Series 2" in the graph below? The documentation points to https://api.highcharts.com/highcharts/plotOptions.flags . However, I can't find an example how additional options are added to "...".

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)

Upvotes: 2

Views: 3087

Answers (1)

Martin Schmelzer
Martin Schmelzer

Reputation: 23889

Just add the argument 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)

For more information: https://api.highcharts.com/highcharts/series.line.showInLegend

Upvotes: 6

Related Questions