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

Making Venn diagrams


Venn diagrams are well known for data visualization. They are used to show the intersection between sets of data. As an example, you could have two groups of objects: one object could belong to both groups, while another could only belong to the first group. Venn diagrams help show that relationship. In this recipe, we will demonstrate how to create Venn diagrams that use two, three, and four sets of data.

Getting ready

Reading the Wikipedia page on Venn diagrams could help you to understand the background behind those diagrams: http://en.wikipedia.org/wiki/Venn_diagram.

How to do it...

The following are the steps required to make a Venn diagram:

  1. First we will need to create the building blocks for our Venn diagrams: the circles and ellipse. The following is the code for the ellipses:

    public class VennEllipse extends Sprite {
        public function VennEllipse(circleWidth:Number, color:uint) {
          graphics.beginFill(color, 0.5);
          graphics.drawEllipse(-circleWidth/2, ...