Made d3 barchart reusable.