Skip to content

Instantly share code, notes, and snippets.

@Thinkscape
Forked from anonymous/inlet.js
Created August 31, 2012 14:56
Show Gist options
  • Save Thinkscape/3554077 to your computer and use it in GitHub Desktop.
Save Thinkscape/3554077 to your computer and use it in GitHub Desktop.
playing with joins and transitions
{"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":600,"height":300,"hide":false},"endpoint":"tributary"}
var data = [{"x": 100, "y": 110}, {"x": 200, "y": 201}];
var data2 = [{"x": 150, "y": 150}, {"x": 210, "y": 202}];
var svg = d3.select("svg");
svg.selectAll("circle")
.data(data)
.enter().append("circle")
.attr("cx", function(d) { return d.x; })
.attr("cy", function(d) { return d.y; })
.transition()
.attr("r", function(d){ return 51;});
setTimeout(function(){
svg.selectAll("circle")
.data(data2)
.transition()
.attr("cx", function(d) { return d.x; })
.attr("cy", function(d) { return d.y; });
;
},1000)
// function(){ return 51;}
Display the source blob
Display the rendered blob
Raw
<svg class="tributary_svg" width="1680" height="667"><circle cx="150" cy="150" r="51"></circle><circle cx="210" cy="202" r="51"></circle></svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment