Last active
August 22, 2016 02:22
-
-
Save 1wheel/7131066 to your computer and use it in GitHub Desktop.
hex-circle
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> | |
<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