refactoring chart util