Refactor bar chart