From Test-Scratch-Wiki

This page will describe the steps to make a simple pie chart, with instructions on upfront circle creation, mouse-overs, statistic analysis, and user-sectioning.

Circles in General

Mathematical Functions are important while using geometry or math in general on scratch. This page will cover the various formulas needed in Scratch, while also going over the circle and ellipse formulas in sections 2.3 and 2.3.1.

In this section:

  • pi is the value of Pi (3.14159...)
  • r is the radius of the circle

This will calculate the area of a circle:

((pi) * ((r) * (r))) // pi * r squared

and this will calculate the circumference of a circle:

((2) * ((pi) * (r)))

Pi is hard to define, so some users like to approximate it to 3.1415926535 or calculate it using atan.

Techniques to Stand Out

Up-front Creation

In this case, the user will be able to see the graph be created in front of them. A unique relationship is that the smaller the turn angle, the bolder your graph will look. However, the smaller the turn angle is, the greater the generation time will be.

repeat ((360) / (turn radius))
go to x: (0) y: (0)
pen down
move (radii) steps
move (radii) steps
turn right (turn radius) degrees


  • Radii is the radius of the circle
  • Turn Radius is how many degrees are in each turn


This code will show you how to make text display and play a sound when you mouse-over a portion of the pie chart.

First type this simple code:

when flag clicked
when [space v] key pressed
go to [mouse-pointer v]

This will make a given icon follow the mouse-pointer.

when flag clicked
if <touching color [#FF0000]?>
repeat until < <touching color [#F3A533]> or <touching color [#FFFFFF]> >
say [Section 1] for (1) secs // change this depending on how long you want the message to display
play sound [pop v] // optional