The area under curves can be tricky to calculate especially if they curve wildly.. If a curve has straightish edges you could creat multiple triangles and squares and calculate the sum of the areas of those shapes.
Another method is to create a rectangle starting from the start position of the curve on the x axis to the end position of the curve on the x axis and either create the rectangle at the minimum height or maximum height of the curve.
This approach is OKish if the curve has a fairly horizontal top end but is likely to underestimate or overestimate the area under the curve for many curves or equations.
These underestimates or overestimates can be reduced by taking more and more thinner rectangles between start and end and summing the total of these rectangles.