First, you write a function that builds a pie chart on the fly onto a "2D array" (not technically possible in JavaScript, but there's a workaround in the examples at faq216-3516). Then you call a graphics plotting routine using that array (not technically possible in JavaScript, but there's a workaround in the examples at faq216-3516).
Your pie chart function will probably have a call like this:
Code:
PieChart(element1, element2, element3, etc.);
where each element is an array:
[value][RGBColor][label]
The function adds all the incoming values together and then uses the total and sub-values to produce angles of the appropriate value, plotting them onto the 2D array graph.
One of the examples in faq216-3516 is building a circle mathematically, so some of the calculations are already laid out for you there.
Cheers,
Edward
"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.