You can install rCharts
from github
using the devtools
package
require(devtools)
install_github("rCharts","timelyportfolio",ref="dimple_layer") # use this specific branch with temp fix
install_github('rCharts_dygraphs', 'danielkrizian')
library(rChartsDygraph); library(quantmod)
getSymbols("SPY", from = "1993-01-01")
SPY <- data.frame(Date=index(SPY), Price=SPY$SPY.Close)
SPY$Momentum20days <- momentum(SPY$SPY.Close, 20)/lag(SPY$SPY.Close, 20)*100
dygraph1 <- dygraph(data=SPY[,c("Date","SPY.Close")], sync=TRUE, crosshair="vertical", legendFollow=TRUE, width=1000)
dygraph2 <- dygraph(data=SPY[,c("Date","Momentum20days")], sync=TRUE, crosshair="vertical", legendFollow=TRUE, width=1000, colors='grey')
layout_dygraphs(dygraph1, dygraph2)
This should produce two charts like here (link)
Zoom: mouse left-click & drag; Pan: Shift + mouse left-click & drag
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.