## Charts and graphs can sometime be a pain to create and animate in After Effects, especially pie charts. This very simple, quick method gets the numbers exact while allowing huge flexibly.

One of my clients is in the banking industry. Needless to say, I create a lot of **animated charts** for their videos. Bar charts are pretty simple (though they can be a little tedious), but I was struggling with an easy way to create **pie charts**. Eventually, I worked out this method that allowed me to be exact on the values, while being easy to create and animate on and off screen.

The first step is to create a precomp inside whatever comp you are working. Aspect doesn’t really matter at all, but it should be reasonably big; I generally make a solid the **same size as my parent comp** and precompose that. In this example, I’ll name the precomp “Pie Chart”. All but the final step in making the pie chart will take place in this precomp. *Click any of the images below for a larger view.*

The next step is to take a solid in your precomp and set both it’s **X Anchor Point and Position values to 0**. This pins it to the left side of the screen, so as you scale it up or down, the left side stays in place.

Now, duplicate that first solid as many times as necessary so that you have the same number of solids as you need slices in your pie chart. Set the colors on the chart to the colors you want each slice to have. I generally go from **dark at the top** to **light at the bottom.** When the chart is complete, it will start at the top and go **counter-clockwise** around the circle, starting with the top layer (you’ll see how this works in a few steps).

Now we get to typing actual values. Here’s the example data set I’ll be using:

**{A=10%, B=15%, C=7%, D=23%, E=15%, F=30%}**

We’re going to do this by scale, which has the advantage of sharing the same “maximum” that a pie chart does of 100%. I’ve used round numbers, but **values with decimal places** work just fine with this method.

What you do is **unlink the scale values**, then go from top to bottom, and set each slices **X-scale** to the value of that particular slice ** plus** the

**scale of the layer above it**. So, the first solid’s scale is just “10%”, since there isn’t a layer above it. The second solid’s scale is “15%” + the 10% from the first layer = 25% (you can just type the math into the property input and it will do the sum for you). The third solid’s scale is “7%” + the 25% from the layer above it = 32% – and so on. You can see the final values here:

If the math confuses you, it works just as well to set up some **expressions**. Put the actual “value” of each slice in the **X-scale**, then option click the stopwatch for each layer’s position, then paste this expression, nothing the instructions for using the **expression pickwhip**:

X = value[0]+(pickwhip the layer above’s X-scale value);

Y = value[1];

[X,Y]

Whether you do the math yourself or set up the expressions to do it for you, you’ll end up with the same values and result:

Now, go back to the main comp, and apply the “**Polar Coordinates**” effect to the precomp:

Change the Type of Conversion to “Rect to Polar” and set Interpolation to “100%”, scale the precomp down a bit, and there you go! You have a perfect pie chart:

One last thing I like to do is an intro animation that’s pretty easy as well. Just go back to the precomp, parent all the solids to the bottom one, then keyframe the bottom solid’s X-scale from “**0%**” to “**100%**”:

I hope this method of creating **pie charts in After Effects** helps you out with **information heavy videos** and animations!