Published
Edited
Nov 17, 2021
Insert cell
Insert cell
stocks = (await Promise.all([FileAttachment("aapl.csv"), FileAttachment("amzn.csv"), FileAttachment("goog.csv"), FileAttachment("ibm.csv")]
.map(async file => [file.name.slice(0, -4).toUpperCase(), await file.csv({typed: "true"})])))
.flatMap(([Symbol, data]) => data.map(d => ({Symbol, ...d})))
Insert cell
Plot.plot({
marginRight: 40,
y: {
grid: true,
label: "↑ Price ($)"
},
marks: [
Plot.line(stocks, {x: "Date", y: "Close", stroke: "Symbol"}),
Plot.text(stocks, Plot.selectLast({x: "Date", y: "Close", z: "Symbol", text: "Symbol", textAnchor: "start", dx: 3}))
]
})
Insert cell
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