Built with blockbuilder.org
Last active
July 11, 2018 04:40
-
-
Save jrzief/cfb37be7f99738c4356e7a0a651bfdbb to your computer and use it in GitHub Desktop.
Concentric Circles
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
license: mit |
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> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<style> | |
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } | |
</style> | |
</head> | |
<body> | |
<script> | |
var radii =[110,100, 90, 80, 70, 60,50,40,30,20,10,0] | |
var width = 960; | |
var height = 500; | |
var svg = d3.select("body").append("svg") | |
.attr("width", width) | |
.attr("height", height) | |
.append("g") | |
.attr("transform", "translate(" + (width - 50)/2 + "," + height/2 + ")"); | |
svg.selectAll('circle') | |
.data(radii) | |
.enter() | |
.append('circle') | |
.attr("cx", 50) | |
.attr("cy", 100) | |
.attr('r', function(d){return d}) | |
.style("stroke", "black") | |
.style("stroke-width", 2) | |
.style("fill", "white"); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment