Skip to content

Instantly share code, notes, and snippets.

@vicapow
Created September 25, 2013 05:01
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/6695325 to your computer and use it in GitHub Desktop.
Save vicapow/6695325 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>
<script>
d3.select('body').selectAll('.bar').data([10, 30, 60])
.enter().append('div')
.attr('class', 'bar')
.style('width', '0%')
.transition()
.duration(2000)
.style('width', function(d, i){ return d + '%'; });
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment