Created
July 20, 2012 07:50
-
-
Save morenoh149/3149367 to your computer and use it in GitHub Desktop.
transition d3js tutorial
This file contains hidden or 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
<meta charset="utf-8"> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
</head> | |
<body> | |
<button class="btn btn-mini" id="button">Transition</button> | |
<script type="text/javascript"> | |
var svg = d3.select("body") | |
.append("svg") | |
.attr("width", 500) | |
.attr("height", 300); | |
var mySquare=svg.append("rect") | |
.attr("x",60) | |
.attr("y",60) | |
.attr("width",60) | |
.attr("height",60); | |
mySquare | |
.style("fill","blue"); | |
var button = d3.select("#button"); | |
button.on("click", function(){ | |
mySquare.transition().style("fill","white"); | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment