In this recipe we are going to build a stacked area chart and allow the user to zoom in on a specific portion of it. You can view the stacked area chart as a pie chart over time. We are going to replicate the behavior of the graphics found on this page http://flare.prefuse.org/apps/job_voyager, but in a simplified manner.
Open the files downloaded from the Packt Publishing website, look into the Chapter 7 | recipe 4 folder, and follow along.
The following are the steps to create the animated stacked area chart:
Create
AnimatedAreaChartData.as
to hold your data.Copy over
HorinzontalAxis.as
andVerticalAxis.as
from the Automatic updates recipe in this chapter.Create
Area.as
; this is where the animations are going to be.Draw the initial shape in the
createArea
function ofArea.as
:graphics.beginFill(color); graphics.moveTo(0, graphHeight - 10 - scaleRatio * topLine[0]); var topLineLength:int = topLine.length; for (i = 1; i < topLineLength...