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

Adding multiple layers to a map


This recipe will make use of every other recipe in this chapter and build on them. We are going to make an interactive map with four layers on it. Two maps, the Canadian provinces from the previous recipe and a layer with some Canadian cities. We will also add a control to show or hide the individual layers.

Getting ready

Since this recipe is going to make use of everything in the previous recipes, it is advised to read the beginning of this chapter.

How to do it...

The following are the steps required to add multiple layers to a map:

  1. Start by generating the data. Use the region data from the previous recipe and we will create data for Canadian cities using the following site as reference, http://www.infoplease.com/ipa/A0001796.html. The following code snippet shows you how to store one city:

    dataCity.push( new LongLat("Calgary", new Coordinate("W", 114, 1), new Coordinate("N", 51, 1)));
  2. Instantiate a Map class just as we have been doing this entire chapter.

  3. Create...