Skip to content

Instantly share code, notes, and snippets.

@peterhry
Forked from mbostock/.block
Created May 15, 2013 05:55
Show Gist options
  • Save peterhry/5581897 to your computer and use it in GitHub Desktop.
Save peterhry/5581897 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<style>
circle {
stroke: #000;
fill-opacity: .1;
}
</style>
<script src="http://mbostock.github.com/d3/d3.js?2.7.1"></script>
<script src="http://mbostock.github.com/d3/d3.layout.js?2.7.1"></script>
<script>
var data = {
children: [
{value: 0},
{value: 0},
{value: 0},
{value: 0},
{value: 0},
{value: 0}
]
};
var width = 960,
height = 500;
var pack = d3.layout.pack()
.size([width, height]);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
svg.data([data]).selectAll(".node")
.data(pack.nodes)
.enter().append("circle")
.attr("class", "node")
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; })
.attr("r", function(d) { return d.r; });
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment