Use the mouse to drag the block to one side. The Action button releases it. As you move the block, the cumulative work done on the spring is plotted vs. position, x. If you move the block to the left compressing the spring or to the right stretching the spring, the amount of work done is the same. The work in both cases is positive because the dot product of force and displacement (f x) is positive when f and x are in the same direction. When the block moves back toward the neutral position work done on the spring is negative since the force and displacement are in opposite directions.

Notice that when you halt a run, the position, net work done on the spring at that point and the kinetic energy of the block at that point are displayed on the screen. The kinetic energy will be minimum when the net work done on the spring is maximum. Why is that, by the way?