You are previewing ActionScript Graphing Cookbook.
O'Reilly logo
ActionScript Graphing Cookbook

Book Description

Learn how to create appealing and interactive visual presentation of your data in ActionScript

  • Learn how to create various visually dynamic graphs and charts

  • Import data from different sources, such as web services

  • Learn how to map geographical data, visualize in 3D

In Detail

"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

  1. ActionScript Graphing Cookbook
    1. Table of Contents
    2. ActionScript Graphing Cookbook
    3. Credits
    4. About the Authors
    5. About the Reviewers
    6. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Getting Started with Graph Drawing
      1. Introduction
      2. Drawing in two dimensions
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Graphics drawing
          2. Coordinate systems and transformations
        5. See also
      3. Building point charts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Coordinate system
          2. Scaling woes
          3. Adding more parameters
        5. See also
      4. Creating a line graph based on a function
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Improving the Graph class
          2. Using points to draw functions
          3. Curves
        5. See also
      5. Adding labels and axes
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Vertical axis
          2. Screen versus graph coordinates
          3. Error checking and adding parameters
      6. Graphing a spreadsheet
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Two arrays
          2. Associative array
          3. Vectors
          4. Associative array to two-dimensional array conversion
        5. See also
      7. Area charts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Having the color as a parameter
          2. The fill style
        5. See also
      8. Multiple area charts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Improving the interface
          2. Styling the fill
      9. Styling a graph
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Transformation
          2. Gradient lines and points, bitmap areas
        5. See also
      10. Adding legends
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. TextField customization
          2. A background
        5. See also
      11. Using Flex for charts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Flex without MXML
          2. ActionScript in Flex
        5. See also
    9. 2. Working with Data
      1. Introduction
      2. Preparing your data
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Databases
      3. Embedding CSV files
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. CSV parsing
        5. See also
      4. Loading a data file from the Internet
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Other events
          2. Relative URL
          3. Security and cross-domain policies
        5. See also
      5. Loading a file from the local hard drive
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Cancel file browsing
        5. See also
      6. Loading data with XML
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Loading from other sources
          2. Different XML structures
      7. Loading data from Excel files
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. as3xls
        5. See also
      8. Consuming the REST services
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. More web APIs
          2. Using SOAP services
      9. Exporting data as CSV to import in Excel
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Semicolon or comma
          2. CSV header
      10. Exporting data to a PDF file
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Headers and footers
          2. Adding images
        5. See also
    10. 3. Creating Bar Charts
      1. Introduction
      2. Drawing a bar chart with Flex
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Showing data tips
          2. Displaying vertical bars
          3. Adding more bars
        5. See also
      3. Building vertical bar charts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Styling
          2. Interactivity
          3. Accommodating a wider data range
        5. See also
      4. Creating comparison bar charts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Adding a legend
        5. See also
      5. Drawing histograms
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Data range
          2. So many bars
        5. See also
      6. Creating sparklines to enrich text content
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Adding the area under the line
          2. Averaging the data
      7. Making 3D bar charts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Using gradient
          2. Using a real 3D engine
        5. See also
    11. 4. Drawing Different Types of Graphs
      1. Introduction
      2. Drawing a pie chart with Flex
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Bevel or not
        5. See also
      3. Creating donut charts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Labels
          2. Donut chart as a pie chart
        5. See also
      4. Drawing meters and gauges
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Animation
          2. Using the Flash IDE
        5. See also
      5. Making Venn diagrams
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Interactivity
          2. More sets
      6. Building pyramid charts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Getters and setters
          2. 3D!
        5. See also
      7. Drawing bubble charts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Interactivity
          2. Legends
        5. See also
      8. Creating tag clouds
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Modifying the alpha
          2. Using embedded fonts
      9. Creating a treemap
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Representing small values
          2. Using a tree as data
        5. See also
    12. 5. Adding Interaction
      1. Introduction
      2. Zooming and panning around a graph
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Cleaning up the code
          2. Using the mousewheel
          3. Centering on zoom
          4. Fix axes
      3. Sending data updates to the graph
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Scrolling data
          2. Random access
          3. Undo
          4. Dispatching and listening for events
      4. Making the points interactive: Hovering
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Attaching data to points
          2. Better display
      5. Selecting data points in the graph
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Selection by clicking
          2. Drawing selected items
          3. Adding to and removing from a selection
      6. A dynamic graph based on an editable table
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Data validation
          2. Zoom/pan on entry
      7. Dragging data points to new values
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Processing the new location
          2. More freedom
          3. Adding and removing points
      8. Linking graphs
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Multiple data sets
          2. Animation
    13. 6. Mapping Geographical and Spatial Data
      1. Introduction
      2. Showing a map using the openscales.org API
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Custom controls
          2. Using different maps
      3. Adding points of interest to a map
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Changing the marker
          2. A URL for image
          3. Making the marker interactive
      4. Parsing data to use as region fill
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Checking for errors
        5. See also
      5. Coloring a map
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Using different countries
          2. Using another color range
        5. See also
      6. Adding multiple layers to a map
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Making your own LayerManager control
          2. Animating turning on/off layers
      7. Overlaying a heat map
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Using more precise data
          2. Starting from blue
    14. 7. Animating a Graph
      1. Introduction
      2. Animating between two data sets
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Using TweenLite
        5. See also
      3. Animating a meter
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Visualizing easing functions
        5. See also
      4. Automatic updates
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Horizontal axis
        5. See also
      5. Zooming in on a specific data set
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Adding a back button
          2. Reverse animation
        5. See also
      6. Animating subway locations
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Collisions
          2. Playing the sounds
        5. See also
    15. 8. Creating a Relational Network
      1. Introduction
      2. Preparing the data
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Links for more theory
        5. See also
      3. Creating the visual for a node
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Styling
      4. Arranging and linking the nodes
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Box2D
          2. Showing more than one level
      5. Navigating through the relational network
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Refactoring
      6. Animating the transitions
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Different animation for navigating to a child
        5. See also
      7. Adding sounds
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Saving space
    16. 9. Creating Three-Dimensional Graphs
      1. Introduction
      2. Drawing in 3D: a 3D starter project
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. The maths
          2. 3D and games
          3. Away3D 3
      3. Creating a 3D column chart
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. View3D
          2. Two views
          3. Shadows
      4. Moving around the chart
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Other controllers
          2. Lenses
          3. Other ways of moving
          4. Controllers not just for cameras
      5. Beyond the cube, drawing different shapes
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. More shapes
          2. Defining your own geometry
          3. Loading 3D shapes
      6. Graphing tabular data in 3D
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Transparent materials
          2. A more generic Graph3D class
          3. Other shapes and materials
      7. Styling the graph with different materials
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Different image on each cube face
          2. Text
          3. Fine-tuning texture mapping
      8. Graphing a function in three dimensions
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. One geometry
          2. Color change based on height
          3. Two-sided surfaces
        5. See also
    17. 10. Working with Various 3D Graph Types
      1. Introduction
      2. Mapping keyboard usage in 3D, part 1: The model
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. External 3D editor
          2. Manipulating the shadows
        5. See also
      3. Mapping keyboard usage in 3D, part 2: The data
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Key material
          2. Read data directly from Wikipedia
          3. Showing labels on hover
      4. 3D world population chart, part 1: The globe
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. 3D world population chart, part 2: Dressing up
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Adding effects
          2. Still more effects
      6. 3D world population chart, part 3: The data
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Data set picker and loader
        5. See also
    18. Index