chart refactoring