library(dygraphs)
You can create candlestick/OHLC charts with dyCandlestick
function. For example:
library(xts) data(sample_matrix) m <- tail(sample_matrix, n = 32) dygraph(m) %>% dyCandlestick()
Candlestick charts use the first four data series to plot, the rest of the data series (if any) are rendered with line plotter:
m <- cbind(m, apply(m[, 1:3], 1, mean)) colnames(m)[5] <- "Mean" dygraph(m) %>% dyCandlestick()
You can also use compress
function argument to compress chart data annually,
quarterly, monthly, weekly or daily depending on the current chart zoom level to
prevent chart bars overflow:
library(xts) data(sample_matrix) dygraph(sample_matrix) %>% dyCandlestick(compress = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.