refactoring historicalBarChart