function to updateLineChart (Part 1)