Created
October 19, 2013 21:50
-
-
Save vicapow/7061987 to your computer and use it in GitHub Desktop.
the simplest pie chart example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script> | |
var vis = d3.select('body').append('svg').append('g') | |
.attr('transform', 'translate(200,200)') | |
, color = d3.scale.category10() | |
, arc = d3.svg.arc().outerRadius(100).innerRadius(0) | |
, pie = d3.layout.pie() | |
, arcs = vis.selectAll('path').data(pie([4,5,6])) | |
.enter().append('path').attr({ | |
d: arc, fill: function(d, i){ return color(i) }, stroke: 'white' }) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment