Insert cell
Insert cell
Insert cell
Insert cell
extract = attribute=>data0.map(d=>d[attribute]);

Insert cell
extract1 = attribute=>data1.map(d=>d[attribute]);
Insert cell
date1 = extract1('date')
Insert cell
close1 = extract1('close')
Insert cell
extract2 = attribute=>data2.map(d=>d[attribute]);
Insert cell
date2 = extract2('date')
Insert cell
close2 = extract2('close')
Insert cell
date0 = extract('date')
Insert cell
close0 = extract('close')

Insert cell
Insert cell
Insert cell
//percentChange = data => data.map((d,i,A)=>(Math.round(100*(d.close-A[0].close)/A[0].close)))
percentChange = data => data.map((d,i,A)=>(Math.round(100*(d-A[0])/A[0])))

Insert cell
change = percentChange(close0)
Insert cell
change1 = percentChange(close1)
Insert cell
nMonths = 60;
Insert cell
range = '1mo'
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
years = [2015, 2015, 2015, 2015, 2015, 2015]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plotly = require("https://cdn.plot.ly/plotly-latest.min.js")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more