# Pie Chart

**URL:** <https://forum.kirupa.com/t/pie-chart/279420>\
**Category:** Uncategorized\
**Created:** [January 14, 2009, 4:02pm UTC](https://forum.kirupa.com/t/pie-chart/279420 "2009-01-14T16:02:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brutium](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@Brutium](https://forum.kirupa.com/u/Brutium)\
**Post date:** [January 14, 2009, 4:02pm UTC](https://forum.kirupa.com/t/pie-chart/279420/1 "2009-01-14T16:02:16Z")

</div>

Hi Everyone,

I have been struggling with this dilemma for some time now, and I can’t find a solution. What I need to do is subdivide a section of my Pie chart into several subsections. I should be able to input the number of subsections and as well the percentage of the section. What I mean is if my section is worth 25% of the total pie chart, then I would like to subdivide this sections in, let say, 3 subsections. Can this be accomplished?

I am using Actionscript 2.0 and Flash CS4.

[COLOR=red]So far I have this code[/COLOR]

```auto
onClipEvent (load) {
share_value=new Array();
share_color=new Array();
share_name=new Array();
// these are editable 
total_elements = 5;

share_value[0] = 20;
share_color[0] = "0xff0000";
share_name[0] = "Knowledge";

share_value[1] = 15;
share_color[1] = "0x00ff00";
share_name[1] = "Thinking";

share_value[2] = 15;
share_color[2] = "0x00ffff";
share_name[2] = "Communication";

share_value[3] = 20;
share_color[3] = "0x0000ff";
share_name[3] = "Application";

share_value[4] = 30;
share_color[4] = "0xffff00";
share_name[4] = "Final";

[COLOR=darkred][COLOR=red]and also the following:[/COLOR]
[/COLOR]
pie._visible=false;
_parent.label._visible=false;
last_angle=0;
for (i=0; i<total_elements; i++) {
angle = Math.round((share_value*/100)*360);
duplicateMovieClip(_parent.label, "label_" add i, i);
_parent["label_" add i].name = share_name*;
_parent["label_" add i]._y += (_parent["label_" add i]._height+4)*i
patch_color = new Color(_parent["label_" add i].color_patch);
patch_color.setRGB(share_color*);
for (j=last_angle;j<last_angle+angle;j++) {
duplicateMovieClip(pie, "pie_" add j, j);
pie_color = new Color(this["pie_" add j]);
pie_color.setRGB(share_color*);
this["pie_" add j]._rotation = j;
}
last_angle = last_angle + angle;
}
stop();

```

Can anyone help me get out of this problem?

Thank you

Brutium
