refactor chart