If the force varies in magnitude with the displacement of the object, the total work done by the force is given by the area under the graph of $F$ vs $s$.
$F=$force; $s=$displacement in the direction of the force.