Published
Edited
Mar 30, 2019
Fork of Tree-o-Matic
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
viewof algorithm = html`<select>
<option selected value="tree">Tree
<option value="cluster">Cluster
<option value="cluster-no-separation">Cluster (no separation)
</select>`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = cstParseRows(sourceWithHeader, ([name, crosslinks, url]) => ({name, crosslinks, url})).children[1]
Insert cell
tree = data => {
const root = d3.hierarchy(data);
root.dx = 20;
root.dy = width / (root.height + 1);
let layout;
switch (algorithm) {
case "cluster": layout = d3.cluster(); break;
case "cluster-no-separation": layout = d3.cluster().separation(() => 1); break;
case "tree": layout = d3.tree(); break;
}
return layout.nodeSize([root.dx, root.dy])(root);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more