refactor chart component