Skip to content

Instantly share code, notes, and snippets.

@vicapow
Last active December 23, 2015 21: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 vicapow/6695426 to your computer and use it in GitHub Desktop.
Save vicapow/6695426 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<style>
.bar{
height: 10px;
background-color: blue;
border-bottom: 1px solid white;
}
</style>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<script>
// set the width of the three bars in our bar chart, then remove them after 3 seconds.
d3.selectAll('.bar')
.data([10, 30, 60])
.style('width', function(d, i){ return d + '%'; })
.data([])
.exit()
.transition()
.duration(2000)
.style('opacity', '0.0')
.remove();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment