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

Animating subway locations


In this recipe we are going to replicate the visualization found on http://www.mta.me, done by Alexander Chen. The original piece is done in HTML, but we are going to do it in Flash, without the music component.

Getting ready

Open the files downloaded from the Packt Publishing website, look into the Chapter 7 | recipe 5 folder, and follow along.

How to do it...

The following are the steps required the animate the New York City subway system:

  1. Head over to http://www.mta.info/developers/download.html and download the New York City Transit Subway data.

  2. From the data derive these information: line color, departures, and duration of each trip.

  3. Download this map: http://www.nycsubway.org/perl/caption.pl?/img/maps/system_1972.jpg and open it in Photoshop.

  4. In Photoshop, note the coordinates for the paths of each line.

  5. Create Main.as and copy the data into it.

  6. Create the Subway class.

  7. In its constructor, determine the distance of each section of the path and with that information...