34,79 €
"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.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 360
Veröffentlichungsjahr: 2012
Copyright © 2012 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: November 2012
Production Reference: 1091112
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK
ISBN 978-1-84969-320-2
www.packtpub.com
Cover Image by Asher Wishkerman (<[email protected]>)
Authors
Peter Backx
Dominic Gélineau
Reviewers
Carlos Estebes
Prashanth Hirematada
Do The Thuan
Acquisition Editor
Joanna Finchen
Lead Technical Editor
Arun Nadar
Technical Editor
Jalasha D'costa
Project Coordinator
Abhishek Kori
Proofreaders
Maria Gould
Lawrence A. Herman
Aaron Nash
Indexer
Tejal Soni
Graphics
Valentina D'silva
Aditi Gajjar
Production Coordinator
Shantanu Zagade
Cover Work
Shantanu Zagade
Peter Backx has a MoS and a PhD in Computer Sciences from Ghent University. He is a software developer and architect. He uses technology to shape unique user experiences and build rock-solid scalable software. ActionScript is his favorite tool for creating highly interactive and deeply engaging user interfaces.
Peter currently works as a freelance consultant and shares his knowledge and experiments on his blog www.streamhead.com.
Most importantly, I would like to thank Isa and my family for understanding my long days and nights at the computer.
Many of the recipes in this book would not have been possible without the terrific work of all developers in the open source community.
And finally, I'd like to thank everyone at Packt Publishing for giving me this opportunity and supporting me with advice and careful follow-up.
Dominic Gélineau has been developing Flash websites and applications for the last five years, including two years at B-Reel New York, worldwide leader in producing rich web experiences. He has a degree in Communications and one in Computer Science. His areas of expertise are animations, interfaces, and analytics. Dominic writes about these subjects on his blog http://www.zedia.net.
Carlos Estebes is the founder of Ehxioz (http://ehxioz.com/), a Los Angeles-based software development startup that specializes in developing modern web applications and utilizing the latest web development technologies and methodologies. He has over 10 years of web development experience and holds a BSc in Computer Science from California State University, Los Angeles.
Carlos previously collaborated with Packt Publishing as a technical reviewer in the third edition of Learning jQuery.
Prashanth Hirematada is the CTO and co-founder of Kwestr and has over 15 years of experience in building e-commerce, gaming platforms, social games, and apps. Previously, he co-founded (2007) "In Game Ad Interactive", invested by WPP. He's also the founder of Gamantra in 2006, a game technology company. Before that he was a Chief Architect at Shanda Interactive Entertainment Ltd. [NASDAQ: SNDA]. He had joined Shanda in 2004 through Shanda's acquisition of Zona, Inc., a game technology company in Silicon Valley, California, USA. Prashanth started his career in the valley working for various technology start-up companies involved in NeXT technologies.
Inventor of the spin buffer (Dr. Dobbs's Journal, 2007), he also is a published author of Flash 10 Multiplayer Game Essentials (by Packt Publishing, UK), and a technical reviewer of game-related books.
Do The Thuan is a passionate self-taught Senior Flash Developer who has been in love with programing since the age of MS-DOS and Turbo Pascal. He inadvertently discovered the beauty and power of Flash and started to learn 2D Animation and Actionscript, then got his first professional job in 2007. During his career, he has built numerous interactive websites, media players, galleries, and rich internet applications, and started several open source projects on http://github.com/thienhaflash. He also did some Unity3D works, mostly mini games for iOS devices and unity editor extensions.
With a special interest in optimization and a sound mathematics background, he is always looking for better ways to improve the performance and memory usage of Flash. He occasionally puts experiments and tutorials on his personal blog at http://thienhaflash.wordpress.com.
I would like to give a special thanks to my father for being such a wise guider of all my life.
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
The cookbook that you are reading will show you how to draw a myriad of graphs in ActionScript. ActionScript is one of the easiest ways to represent graphical information to users across browsers and platforms. It allows you to add a wide range of dynamic effects and interactions to your graphs and charts.
We'll start from the humble beginnings, explaining a little about the ActionScript display list and end at full-blown interactive 3D graphs. In between, you will get to see what goes into animating graphs, adding interaction, and much, much more.
Chapter 1, Getting Started with Graph Drawing, goes over the basics of drawing in ActionScript. We cover everything needed to draw graphs, such as the display list and transformations.
Chapter 2, Working with Data, will explain how you can import data into your ActionScript program. There are many types of graphs, but all of them are based on data.
Chapter 3, Creating Bar Charts, gives us all the tools to create multiple bar charts. Be it vertical, horizontal, comparison, or histograms, this chapter will provide solid bases to improve those charts even more.
Chapter 4, Drawing Different Types of Graphs, will go through an array of different charts, each presented in different recipes, some common such as the Venn diagram, some less common such as the Treemap.
Chapter 5, Adding Interaction, covers how you can give the user various options to interact with the graph. Selecting, zooming, and panning will be explained as well as a few other options.
Chapter 6, Mapping Geographical and Spatial Data, will show how to bring data and maps together to derive further meaning. We will start with simple recipes just showing a map and points of interest and ending up generating heat maps.
Chapter 7, Animating a Graph, explores how to animate graphs using different techniques and animation libraries.
Chapter 8, Creating a Relational Network, shows how to create a relational network, a data visualization that is used to represent a tree data structure, from scratch.
Chapter 9, Creating Three-Dimensional Graphs, lays the groundwork for drawing 3D graphs. Although this is not for the faint of heart, 3D graphs can add a tremendous "wow" factor to your application. This is the first chapter on 3D that gives a high-level overview of everything involved in drawing in 3D, and shows how you can draw some basic graphs.
Chapter 10, Working with Various 3D Graph Types, goes all out on 3D. We'll show you why 3D can add real value to your graphs by applying data to models of real life objects.
In order to compile and run the examples in this book, you need an ActionScript compiler, which was most likely included with the ActionScript IDE that you are using. You can also use the freely available Flex SDK (http://www.adobe.com/devnet/flex/flex-sdk-download.html).
You can create the ActionScript files in any text editor you want, but the example code uses FlashDevelop (http://www.flashdevelop.org/). The code will also work verbatim with any other Flash editor, but you may need to use slightly different menu options than the ones mentioned in the How to do it... sections. However, the differences will be minimal.
Most of the book's code can run with any ActionScript 3 player, but the 3D chapters require at least version 11. You may also want to install the debug version of the players, because these add some useful features for development. They can be downloaded from http://www.adobe.com/support/flashplayer/downloads.html.
This book is for anyone interested in creating interactive and dynamic graphs in ActionScript. Some programming knowledge is required to understand the examples, preferably in ActionScript 3, but you will be able to understand most of the code if you know any modern object-oriented programming language (for example, Java or C#).
Although an understanding of the ActionScript 3 display list will be very useful, it is not a requirement. The parts needed for drawing graphs are all explained in the first chapter and throughout the book whenever something new is introduced.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title through the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
We also provide you a PDF fle that has color images of the screenshots/diagrams used in this book. The color images will help you beter understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/3202_Images.pdf.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the erratasubmissionform link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
In this chapter, we will cover:
In this chapter, we will see a number of recipes that go into the very basics of drawing in ActionScript. The recipes will explain the coordinate system, so that you know where you are drawing. A quick overview of the ActionScript DisplayList object and other ActionScript drawing functions is given.
A final recipe shows how Flex can be used to generate many standard graphs with virtually no actual programming. Flex is not the focus of the recipes, but the book wouldn't be complete without at least some coverage of the framework and its functions related to graph drawing.
Although we do not expect you to be an ActionScript expert, some basic knowledge will help you in quickly understanding and applying the recipes presented. Also, we will not go into the details of the tools used.
