in reply to GD::Graph - data plotting off the charting area

The activestate manual states

The range (y_min_value..y_max_value) has to include all the values of the data points, or GD::Graph will die with a message.

Which doesn't look like it is true, but it does appear to be causing your issue.
If you change your "Next Code Snippet" to
## Next code snippet goes here $graph->set( y_min_value => 4, y_max_value => 10, x_min_value => 1, x_max_value => 7 );
It will work correctly. The only difference being that the y_min_value and the x_min_value are within the range of the data.