Shorcut for add flags to highstock chart

Description

This function helps to add flags highstock charts created from xts objects.

Usage

1
2
hc_add_series_flags(hc, dates, title = LETTERS[seq(length(dates))],
  text = title, id = NULL, ...)

Arguments

hc

A highchart htmlwidget object.

dates

Date vector.

title

A character vector with titles.

text

A character vector with the description.

id

The name of the series to add the flags. A previous series must be added whith this id.

...

Aditional shared arguments for the *flags* data series (http://api.highcharts.com/highstock#plotOptions.flags)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 

library("quantmod")

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

dates <- as.Date(c("2015-05-08", "2015-09-12"), format = "%Y-%m-%d")
highchart(type = "stock") %>% 
  hc_add_series_xts(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") 

## End(Not run)
                      

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.