Book Image

ActionScript Graphing Cookbook

Book Image

ActionScript Graphing Cookbook

Overview of this book

"A picture is worth a thousand words" has never been more true than when representing large sets of data. Bar charts, heat maps, cartograms, and many more have become important tools in applications and presentations to quickly give insight into complicated issues.The "ActionScript Graphing Cookbook" shows you how to add your own charts to any ActionScript program. The recipes give step-by-step instructions on how to process the input data, how to create various types of charts and how to make them interactive for even more user engagement.Starting with basic ActionScript knowledge, you will learn how to develop many different types of charts.First learn how to import your data, from Excel, web services and more. Next process the data and make it ready for graphical display. Pick one of the many graph options available as the book guides you through ActionScript's drawing functions. And when you're ready for it, branch out into 3D display.The recipes in the "ActionScript Graphing Cookbook" will gradually introduce you into the world of visualization.
Table of Contents (17 chapters)
ActionScript Graphing Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Building pyramid charts


Pyramid charts are very similar to pie charts and can be mostly used for the same purpose. But there is one more piece of information that can be given by using pyramid charts, a sense of hierarchy. The pyramid has a top and bottom layer and there are layers in between too, usually the top layer being the most important.

Getting ready

Look at the project files in the code folder. Also, having a good grasp on the Pythagorean theorem, available at http://en.wikipedia.org/wiki/Pythagorean_theorem, is important.

How to do it...

The following are the steps required to create a pyramid chart:

  1. First we will create the data structure to represent a layer in our pyramid chart. The following is PyramidData.as:

    public class PyramidData {
       public var startingPercent:Number;
        public var endingPercent:Number;
        public var label:String;
        public var color:uint;
        public var labelOustideOfChart:Boolean;
    
        public function PyramidData(newStartingPercent:Number, newEndingPercent...