Built with blockbuilder.org
Last active
February 23, 2016 17:10
-
-
Save Smith5mr/4072644aa05429838994 to your computer and use it in GitHub Desktop.
fresh block
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://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> | |
<style> | |
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } | |
svg { width:100%; height: 100% } | |
</style> | |
</head> | |
<body> | |
<script> | |
var jsonCircles = [ | |
{ "x_axis": 30, "y_axis": 30, "radius": 20, "color" : "green" }, | |
{ "x_axis": 70, "y_axis": 70, "radius": 20, "color" : "purple"}, | |
{ "x_axis": 110, "y_axis": 100, "radius": 20, "color" : "red"}]; | |
var svgContainer = d3.select("body").append("svg") | |
.attr("width", 200) | |
.attr("height", 200); | |
var circles = svgContainer.selectAll("circle") | |
.data(jsonCircles) | |
.enter() | |
.append("circle"); | |
var circleAttributes = circles | |
.attr("cx", function (d) { return d.x_axis; }) | |
.attr("cy", function (d) { return d.y_axis; }) | |
.attr("r", function (d) { return d.radius; }) | |
.style("fill", function(d) { return d.color; }); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment