 This article is a stub. It may be incomplete, unfinished, or have missing parts/sections. If the article can be expanded, please do so! There may be suggestions on its talk page. (February 2017)

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 can be 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 the 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
go to x: (0) y: (0)
```

Where:

• Turn Radius is how many degrees are in each turn

### Mouseovers

This script makes text display and play a sound when the mouse is hovered over a portion of the pie chart.

First create this simple code:

```when flag clicked
hide
```
```when [space v] key pressed
show
forever
go to [mouse-pointer v]
end
```

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

```when flag clicked
forever
if <touching color [#FF0000]?> then
repeat until < <touching color [#F3A533]> or <touching color [#FFFFFF]> >
say [Section 1] for (1) secs // change this depending on how long the message should be displayed
play sound [pop v] // optional
end
end
end
```