library(quantmod)
getSymbols("GS")
x = candleChart(GS,multi.col=TRUE,theme='white', plot = F)
data_ = as.matrix(x@xdata)
require(rCharts)
r1 <- rCharts$new()
r1$setLib('echarts')
r1$set(series = list(list(
name = 'GS',
data = toJSONArray2(data_[,1:4], names = F, json = F),
type = 'k'
)))
r1$set(xAxis = list(list(
type = 'category',
data = gsub("-", "/", rownames(data_))
)))
r1$set(yAxis = list(list(
type = 'value',
scale = TRUE
)))
r1$set(tooltip = list(
trigger = 'axis'
))
r1$set(dataZoom = list(
show = TRUE,
realtime = TRUE,
start = 0,
end = 50
))
r1