Skip to content

Instantly share code, notes, and snippets.

@michaelcolenso
Created January 15, 2013 07:55
Show Gist options
  • Select an option

  • Save michaelcolenso/4537032 to your computer and use it in GitHub Desktop.

Select an option

Save michaelcolenso/4537032 to your computer and use it in GitHub Desktop.
var dataset = [];
for (var i = 0; i < 25; i++) {
var newNumber = Math.random() * 30;
dataset.push(newNumber);
}
d3.select(".container").selectAll("div")
.data(dataset)
.enter()
.append("div")
.attr("class", "bar")
.style("height", function(d) {
var barHeight = d * 5;
return barHeight + "px";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment