Created
July 25, 2015 13:38
-
-
Save aaizemberg/b77e897ec9dcf1c53118 to your computer and use it in GitHub Desktop.
Gráfico de barras con DIVs desde D3.js
This file contains 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
<!DOCTYPE html> | |
<head> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<style> | |
.chart div { | |
font: 10px sans-serif; | |
background-color: green; | |
text-align: right; | |
padding: 3px; | |
margin: 1px; | |
color: white; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="chart"></div> | |
<script> | |
var v = [4,8,15,16,23,42]; | |
d3.select("div.chart") | |
.selectAll("div").data(v).enter().append("div") | |
.text( function(d,i) { return d; } ) | |
.attr("style", function(d,i) { return "width: "+d*10+"px;"; } ); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment