var graphs = []

function draw_graph(e, dataset) {
	var w = parseInt(d3.select(e).style('width'), 10);
	var h = 70;
	var padding = 22;

	var scaleY = d3.scale.linear()
		.domain([0, d3.max(dataset)])
		.range([0, h-padding]);

	var scaleX = d3.scale.linear()
		.domain([48, 0]).range([padding/2, w-(padding)]);

	d3.select(e).select("svg").remove();
	var svg = d3.select(e)
		.append("svg")
		.attr("width", w)
		.attr("height", h);

	var axis = d3.svg
		.axis()
		.tickFormat(function(d){ return d + "h ago"; })
		.scale(scaleX);

	var axisY = d3.svg
		.axis()
		.scale(d3.scale.linear().domain([0, d3.max(dataset)]).range([h, 0]))
		.ticks(3)
		.orient("left");

	var tip = d3.tip()
		.attr('class', 'd3-tip')
		.offset([-10,0])
		.html(function(d) { return d; });

	svg.call(tip);

	svg.append("g")
		.attr("class", "axis")
		.attr("transform", "translate(20," + (h-padding) + ")")
		.call(axis);

	svg.append("g")
		.attr("class", "axis")
		.attr("transform", "translate(31, -" + padding + ")")
		.call(axisY);

	svg.selectAll("rect")
		.data(dataset)
		.enter()
		.append("rect")
		.attr("x", function(d, i) {
			return w-scaleX(i);
		})
		.attr("y", h - padding - 2)
		.attr("width", w / dataset.length - 2)
		.attr("height", 0)
		.on('mouseover', tip.show)
		.on('mouseout', tip.hide);

	svg.selectAll("rect")
		.transition()
		.delay(function(d, i) {
			return (dataset.length - i) * 20;
		})
		.duration(500)
		.attr("y", function(d) { return (h - padding)-scaleY(d) - 2; })
		.attr("height", function(d) {
			return scaleY(d);
		});

}

function draw_graphs() {
	for (var i=0; i<graphs.length; i++) {
		draw_graph(graphs[i].e, graphs[i].dataset);
	}
}

d3.select(window).on('resize', draw_graphs);

@@ -289,10 +289,8 @@
 ding
-/2
 , w-
@@ -297,16 +297,18 @@
 (padding
+*2
 )%5D);%0A%0A%09d
@@ -486,29 +486,123 @@
 (d)%7B
- return d + %22h ago%22; 
+%0A%09%09%09var current = new Date();%0A%09%09%09current.setHours(current.getHours() - d);%0A%09%09%09return current.getHours() + %22:00%22;%0A%09%09
 %7D)%0A%09
@@ -712,17 +712,30 @@
 .range(%5B
-h
+(h-padding)-10
 , 0%5D))%0A%09
@@ -742,17 +742,17 @@
 %09.ticks(
-3
+2
 )%0A%09%09.ori
@@ -1079,28 +1079,35 @@
 ate(
-31, -
 %22 + 
+((
 padding
- + %22
+-1)*2) + %22, 10
 )%22)%0A

Clean up the bar chart