Made barchart functional