refactor the line chart