Published
Edited
Dec 9, 2021
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
vl
.markLine({ tooltip: true })
.data(allTeamData.map(d => _reduce(d, key)))
.encode(
vl
.x({
axis: { grid: false },
scale: { domain: d3.extent(years) }
})
.fieldQ("year"),
vl.y({ axis: { grid: false } }).fieldQ("value")
)
.config({ view: { stroke: null } })
.width(width * .75)
.height(350)
.render()
Insert cell
Insert cell
async function* getData() {
const out = [];
for await (const yearData of years.map(y => getClient(y))) {
out.push(yearData);
yield out;
}
return out;
}
Insert cell
_reduce = (yearData, k) => {
const { year, teams } = yearData;
const stat = yearData["per_poss-team"].get([k]);
return {
year,
value: d3.sum(stat, (d) => d[k]) / teams.length
};
}
Insert cell
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