D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
mbostock
Full window
Github gist
Pack Test
<!DOCTYPE html> <meta charset="utf-8"> <style> circle { fill-opacity: .1; stroke: #000; } </style> <body> <script src="//d3js.org/d3.v3.min.js"></script> <script> var root = { children: [ { children: [ {value: 42}, {value: 10, dummy: 1} ] }, {value: 42}, {value: 10, dummy: 1} ] }; var width = 960, height = 500; var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height) var pack = d3.layout.pack() .size([width, height]); svg.selectAll("circle") .data(pack.nodes(root).filter(function(d) { return !d.dummy; })) .enter().append("circle") .attr("cx", function(d) { return d.x; }) .attr("cy", function(d) { return d.y; }) .attr("r", function(d) { return d.r; }); </script>
https://d3js.org/d3.v3.min.js