Public
Edited
Oct 29, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pow = d3.scalePow()
.domain([margin.left, width - margin.right])
.range([margin.left, width - margin.right])
.exponent(k)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
columns_ordered = orderByRegion(series).map(i => series[i].key).reverse();
Insert cell
orderByRegion = series => {
return d3.stackOrderInsideOut(series).map((i,idx) => idx).sort((a,b) => {
let ca = counties[series[a].key];
let cb = counties[series[b].key];
return regions.indexOf(ca ? ca.region : undefined) - regions.indexOf(cb ? cb.region : undefined);
});
};
Insert cell
Insert cell
Insert cell
Insert cell
change = key => {
let v = stats[stats.length - 1][key];
if (opts.includes('by_pop')) {
v = (v * 1000).toPrecision(2);
return `${opts.includes('cumulative') ? v : ('+' + v)}‰`;
}
return opts.includes('cumulative') ? v : ('+' + v);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
darker = color => culori.formatHex((o => ({...o, l: o.l - 10 }))(culori.lch(color)))
Insert cell
html`<style type='text/css'>
svg path:hover {
fill: black;
stroke: none;
}
</style>`;
Insert cell
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