Skip to content

Instantly share code, notes, and snippets.

@JohnCoene
Created June 29, 2020 06:39
Show Gist options
  • Save JohnCoene/c0b57c2b2b99babcb6b3105b75371e7f to your computer and use it in GitHub Desktop.
Save JohnCoene/c0b57c2b2b99babcb6b3105b75371e7f to your computer and use it in GitHub Desktop.
Candlestick color
library(echarts4r)
library(quantmod)
getSymbols("GS") #Goldman Sachs
GS <- as.data.frame(GS)
GS$date <- row.names(GS)
# https://echarts.apache.org/en/option.html#series-candlestick.itemStyle.color
GS %>%
e_charts(date) %>%
e_candle(
GS.Open, GS.Close, GS.Low, GS.High,
name = "Goldman Sachs",
itemStyle = list(
color = "blue", # bull
color0 = "black", # bear
borderColor = "blue",
borderColor0 = "black"
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment