Refactor line chart