Skip to content

Instantly share code, notes, and snippets.

@aaizemberg
Last active August 4, 2018 03:20
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 aaizemberg/c862fd841a738c3552b5cd44160068a9 to your computer and use it in GitHub Desktop.
Save aaizemberg/c862fd841a738c3552b5cd44160068a9 to your computer and use it in GitHub Desktop.
2 círculos (con lie factor = 1)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.3/d3.min.js"></script>
<title>lie factor</title>
</head>
<body>
<script>
var radio = d3.scaleLinear()
.domain([0, 100])
.range([0, 50]);
var area = d3.scaleSqrt()
.domain([0, 100])
.range([0, 50]);
var ex = d3.scaleLinear()
.domain([0, 1])
.range([50, 150]);
var svg = d3.select("body")
.append("svg")
.attr("width",200)
.attr("height",200);
var data = [50,100];
svg.selectAll("circle").data(data).enter().append("circle")
.attr("cx", (d,i) => ex(i) )
.attr("cy",100)
.style("stroke","black")
.style("fill","none")
.attr("r", (d) => area(d) );
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment