Code to draw the line chart with averages