D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
romsson
Full window
Github gist
minimalistic treemap hierarchy command line example
Built with
blockbuilder.org
<script src="https://d3js.org/d3-hierarchy.v1.min.js"></script> <script> var treemap = d3.treemap() .size([10, 10]) .padding(10); var stratify = d3.stratify() .id(function(d) { return d.id; }) .parentId(function(d) { return d.parent_id; }); var root = stratify([ {"id": "root", "parent_id": ""}, {"id": "child", "parent_id": "root"} ]); var tree = treemap(root); tree.leaves() console.log(tree, tree.leaves()); </script>
https://d3js.org/d3-hierarchy.v1.min.js