Created
August 1, 2015 13:34
-
-
Save aaizemberg/b076dffdb37495a26387 to your computer and use it in GitHub Desktop.
4 círculos (lie factor = 1)
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> | |
<head> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<meta charset="utf-8"> | |
<title>4 circulos</title> | |
</head> | |
<body> | |
<script> | |
var h = 200, w = 500; | |
var data = [10,25,50,100]; | |
var svg = d3.select("body") | |
.append("svg") | |
.attr("width",w) | |
.attr("height",h); | |
var area = d3.scale.sqrt().domain([0, 100]).range([0, 50]); | |
var px = d3.scale.linear().domain([0, data.length-1]).range([w/(data.length+1), w - (w/(data.length+1)) ]); | |
svg.selectAll("circle").data(data).enter() | |
.append("circle") | |
.attr("cx", function(d,i) {return px(i);} ) | |
.attr("cy", h / 2) | |
// .attr("r", function(d) {return 6*Math.sqrt(d);}); | |
.attr("r", area ); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment