Eng:Pie Chart Creation

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.

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

Where:
 * Radii is the radius of the circle
 * Turn Radius is how many degrees are in each turn

Mouseovers
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 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  repeat until <  or  > say [Section 1] for (1) secs // change this depending on how long you want the message to display play sound [pop v] // optional end end end