I am working on a Pie Chart, and am using a tutorial that states…
An easy way to get the relative value is to normalize the array and use the normal value
[0, 1]
to arrive at the angle of the slice, ie.normal * 2 * M_PI
. For example, if the normal value is0.5
, the angle of the slice will beM_PI
or180°
.
What do they mean, by normal? Ok, so I looked it up (hey, I got a 5 on the Calculus AP, but that was a long time ago).. and realize now that to normalize means to
multiply (a series, function, or item of data) by a factor that makes the norm or some associated quantity such as an integral equal to a desired value (usually 1). • Computing (in floating-point representation) express (a number) in the standard form with regard to the position of the radix point, usually immediately following the first nonzero digit.
OK, so I'm sure I could figure that out.. but again, imagine this is a golden-retriever trying to do this... Going into it, I had imagined I'd be calculating my "slices" like…
10 items = 100% ( item.count / items.total ) * 360 = slice.angle
Seems simple enough. Maybe too simple. Am I missing something here? Is there a reason that I should be using normalization for this, opposed to something more familiar / simplistic? Thanks.