block by aaizemberg b77e897ec9dcf1c53118

Gráfico de barras con DIVs desde D3.js

Full Screen

index.html

<!DOCTYPE html>
<head>

<script src="//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>