Published
Edited
Jul 7, 2020
1 fork
Insert cell
md`# Circle packing`
Insert cell
flare = d3.csvParse(await FileAttachment("frequency_with_count.csv").text())
Insert cell
d3=require("d3@5","d3-array@2")
Insert cell
reduceFn = iterable => d3.sum(iterable, d => d["percent"]);
Insert cell
groupingFns = [d => d.cate]
Insert cell
rollupData = d3.rollup(flare, reduceFn, ...groupingFns);
Insert cell
childrenAccessorFn = ([ key, value ]) => value.size && Array.from(value)
Insert cell
hierarchyData = d3.hierarchy([null, rollupData], childrenAccessorFn)
.sum(([,value]) => value)
.sort((a, b) => b.value - a.value)
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