Moved all the chart rendering code to BarChart class