Public
Edited
Jun 9, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// This is our merged data as it comes from CSV files that should all share the same columns and "mergeable data".
// Think one large spreadsheet with many rows partitioned across a few .csv files.
data = d3
.merge(
// File reads are asynchronous, but we want to merge everything once it is all done.
await Promise.all(files.map(async (d) => await d.csv({ typed: true })))
)
// Whether we sort here or in the Plot code, we need to ensure chronological order or timeseries
// data will look funky.
.sort((a, b) => d3.ascending(a.Date, b.Date))
Insert cell
Insert cell
aapl // Built in sample dataset: https://observablehq.com/@observablehq/sample-datasets#-aapl
Insert cell
// partition data from built-in AAPL stock "observations" (timeseries data)
sample = {
const k = 3;
let arr = d3.range(k).map((d) => new Array());
aapl.forEach((d) => arr[d3.randomInt(k)()].push(d));
return arr;
}
Insert cell
Insert cell
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