refactor chart formatting