Skip to content

Instantly share code, notes, and snippets.

Last active December 11, 2015 00:08
What would you like to do?
Simple Transition

Very simple example of using D3 transitions to move some circles and change their colors

<!DOCTYPE html>
<meta charset="utf-8">
<script src=""></script>
var data = [2,4,3];
var width = 800;
var height = 500;
var svg ="body").append("svg")
.attr("width", width)
.attr("height", height);
.attr("r", function(d) { return 5 * d; })
.attr("fill", "red")
.attr("cx", 40)
.attr("cy", height / 2);
.attr("fill", "green")
.attr("cx", 500)
.attr("cy", function(d, i) { return 100 * (i + 1); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment