d3 egghead 1

by heavyhorse

HTML

<div id="surface"></div>

CSS

#surface {
    margin: 0 auto;
}

JavaScript

var dataset = [ 5, 10, 15, 20, 25 ];

d3.select('#surface').selectAll('div')
	.data(dataset)
	.enter()
	.append('div')
	.attr('class', 'bar')
	.style('display', 'inline-block')
	.style('height', function(d) { return d * 10 + 'px'; })
	.style('width', '16px')
	.style('margin', '0 4px')
	.style('background', '#ddd')
;