Refactor d3 class

I've tried to break apart the graph_d3 class into reasonable methods. Its at the point where extracting the BarGraph specific stuff seems possible.