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

Consuming the REST services


Many websites expose their data through web services. These services usually fall into two categories, SOAP or REST. Many data APIs now tend to prefer the more lightweight REST, which is what we will use in this recipe.

A REST service will usually provide its data in the XML or JSON format. JSON is actually a way of representing data in a piece of JavaScript code. This makes it easy for JavaScript applications to use the data.

For instance, the data we've previously used could look like the following code snippet:

{
  "data" : {
    "0":   [20, 50],
    "50":  [70, 40],
    "100": [0, 100],
    "150": [150, 150],
    "200": [300, 200],  
    "250": [200, 170],
    "300": [170, 160],
    "350": [20, 120],
    "400": [60, 80],
    "450": [250, 150],
    "500": [90, 20],
    "550": [50, 40],
    "600": [110, 90],
    "650": [150, 150],
    "700": [320, 200]
  }
}

You'll notice many similarities with ActionScript. More information on the JSON format can be found at http...