You can color the area, see here, but calculating its area it is a matter of math.
Here is how I would do it:
- first for each point in each series add/insert the point directly above/ below it.
- Now you have a series of polygons with parallel vertical edges.
- The area of each can be split in three parts: the center rectangle and the top and bottom triangle
- width and height are knonw, so the areas are
w*h
for the rectangles and w*h/2
for the triangles.
- the corresponding points are found by interpolating the previous and next points in the corresponding series.
Just a number of simple steps. The harder part is to keep track of the start and stop points and the empty and special cases..
- The normal case is green/magenta below.
- If a side if zero there is no problem
- If a point from series1 is higher or lower than the next on in series2 you need to add two more points and do the calcualting over a tilted polygon. See the orange/cyan lines below!
