refactor charting