Skip to content

Instantly share code, notes, and snippets.

@jfreels
Created March 13, 2013 11:59
Show Gist options
  • Save jfreels/5151442 to your computer and use it in GitHub Desktop.
Save jfreels/5151442 to your computer and use it in GitHub Desktop.
var vis = d3.select("#visualisation");
function update () {
var circles = vis.selectAll("circle").data(randomData(), function (d) { return d.id; });
circles.enter()
.insert("svg:circle")
.attr("cx", function (d) { return d.value1; })
.attr("cy", function (d) { return d.value2; })
.style("fill", "red");
circles.transition().duration(1000)
.attr("cx", function (d) { return d.value1; })
.attr("cy", function (d) { return d.value2; })
.attr("r", function (d) { return d.value3; });
circles.exit ()
.transition().duration(1000)
.attr("r", 0)
.remove ();
setTimeout (update, 2000);
}
update ();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment