Refactor line chart to be object oriented