Refactor the bar chart