Skip to content

Instantly share code, notes, and snippets.

@1wheel
Last active August 22, 2016 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1wheel/7131066 to your computer and use it in GitHub Desktop.
Save 1wheel/7131066 to your computer and use it in GitHub Desktop.
hex-circle
<!DOCTYPE html>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style>
circle{
fill: steelblue;
}
</style>
<body></body>
<script>
var width = 400,
height = 400;
var svg = d3.select('body').append('svg')
.attr('width', width)
.attr('height', height)
.append('g')
.attr('transform', 'translate(' + width/2 + ',' + height/2 + ')');
var points = 6;
svg.selectAll('circle')
.data(d3.range(points)).enter()
.append('g')
.attr('transform', function(d, i){
return 'rotate(' + i*360/points + ') ' + 'translate(' + 100 + ')'; })
.append('circle')
.attr('r', 10);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment