Skip to content

Instantly share code, notes, and snippets.

@gelicia
Created December 19, 2013 04:19
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 gelicia/8034380 to your computer and use it in GitHub Desktop.
Save gelicia/8034380 to your computer and use it in GitHub Desktop.
Helping Dave - new
x1 y1 r1 x2 y2 r2 x3 y3 r3 x4 y4 r4 x5 y5 r5
1.5 0.5 1.58113883 1.5 1.5 1.58113883 2.166666667 2.833333333 2.173067468 0.5 0.5 3.535533906 2.5 2.5 1.58113883
1.5 0.5 1.58113883 2 2.5 2.5 1.5 2.5 1.58113883 2.5 1.5 2.121320344 3.166666667 2.833333333 1.178511302
1.5 0.5 1.58113883 2 2.5 2.5 1.5 2.5 1.58113883 2.5 1.166666667 1.900292375 2.5 2.5 1.58113883
1.5 0.5 1.58113883 1.5 2.5 1.58113883 1.666666667 2.333333333 2.357022604 2.5 1.5 2.121320344 3.5 2.5 1.58113883
1.5 0.5 1.58113883 1.5 2.5 1.58113883 1.5 1.5 2.915475947 2.166666667 1.5 1.900292375 4 1.5 2.5
1.5 0.5 1.58113883 1.5 2.5 1.58113883 1.5 1.5 2.915475947 3.166666667 1.5 2.635231383 2.5 1.5 1.58113883
1.5 0.5 1.58113883 2.5 2 2.5 1.833333333 3.5 1.900292375 2.5 1.5 1.58113883 2.5 2.5 1.58113883
3.5 0.5 3.535533906 2.5 2.5 2.915475947 1.5 2.5 1.58113883 2.5 1.5 1.58113883 3.166666667 2.166666667 1.178511302
3.5 0.5 3.535533906 1.5 2.5 1.58113883 -0.166666667 1.833333333 2.173067468 2.5 1.5 1.58113883 4.5 1.5 1.58113883
2 1 2.236067977 1 2 2.236067977 2 2 2.236067977 1.5 1.5 0.707106781 3.166666667 3.166666667 1.178511302
2 1.5 2.5 1.5 1.5 1.58113883 2 3.166666667 2.166666667 2.5 1.5 1.58113883 2 3.25 1.25
2 1.5 2.5 1.5 1.5 1.58113883 2 4 2 2.5 1.5 1.58113883 2 2.666666667 1.666666667
2 2 2.828427125 1.5 1.5 1.58113883 1.5 2.5 1.58113883 2.5 1.5 1.58113883 2.833333333 2.833333333 1.178511302
{"description":"Helping Dave - new","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"circle-covers.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/ax1KVPK.png"}
var dataset = []
var svg = d3.select("svg");
var data = tributary["circle-covers"];
var bind_data = function(data) {
var circle;
for (var i=0; i < data.length; i++) {
var g = svg.append("g")
.attr("transform","translate(" + ((i % 4)* 204) + "," + (Math.floor(i/4) * 229) + ")");
var range = d3.range(5);
g.selectAll("circle.solution").data(range).enter().append("circle").attr({
cx: function(d){ return 100 + 25 * data[i]["x"+(d+1)];},
cy: function(d){ return 100 + 25 * data[i]["y"+(d+1)];},
r: function(d){ return 33 * data[i]["r"+(d+1)];},
fill: "none",
stroke: "teal"
}).classed("solution", true);
range = d3.range(25);
g.selectAll("circle.dot").data(range).enter().append("circle").attr({
cx: function(d) { return 84 + ((d % 5)* 35);},
cy: function(d) { return 100 + (Math.floor(d/5) * 35);},
r: 3,
fill: "red"
}).classed("dot", true);
}
};
bind_data(data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment