1) draw the graph, close it. then use a floodfill.

2) don't draw the upper graph line, rather, draw decenderlines from the graph point down(up) to the the X axis (you can also view this as...