Time for action – revising the graph
As you see in the previous screenshot, the first point on the graph is moved to the right by 15 pixels. Our first measurement in the data that we graphed occurred at zero minutes is not accurately reflected in our graph. Let's make the graph match the numbers more closely by moving the circle sprite to the left for the first point as follows:
- Add a go to x: () y: () block before the repeat () block.
- Add the expression ((x position) – (15)) to the x value.
- Add the expression ((item (count) of (measurements) * (2)) to the y value. The following screenshot shows the revised script:
What just happened?
Our initial graph didn't properly mark the first point at zero minutes. In our revised script, we moved the circle sprite to the left by 15 pixels so that when we graph the first point in the repeat (length of (measurements)) block, the point was placed properly on the graph.