Refactoring chart data