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

Creating comparison bar charts


In the previous recipe, we learned how to make a simple bar chart. The relation of the data was one-to-one; one label, one value. Now we will make this a bit more complex by adding one more dimension. We will create a bar chart in which the bars are replaced by bar charts. It can be hard to understand it like this, but it gets clearer if you look at the data. For this recipe we will compare the medals (bronze, silver, and gold) won by three different countries at a sporting event.

Getting ready

A good starting point is to copy over the project from the previous recipe (see the Building vertical bar charts recipe). We will modify it a lot, but the core of it will be similar.

How to do it...

The following are the steps required to build a comparison bar chart:

  1. As usual, when we create a new chart, we always start with the data. So we create a new class for it called ComparisonChartData. Check the file out; it is basically a label and a vector of BarData from the...