Axiis Video Tutorial

An experimental alpha release of Axiis has been available since 360|Flex Indy.  I put together this screencast to help people get up and running with the framework.

We’ve gotten some feedback from a few people already, and some users have already told us about the awesome stuff they’re making.  Remember during Tom’s presentation when he showed the Smith Chart, the insanely complex ring of circles that motivated some of our work?  Yeah, we never attempted to implement that.  It was just meant to get people thinking about some of the things that can’t easily be done with other frameworks.  Well, Andrew Westberg took that slide as a challenge and has already implemented it!  Seeing what everyone is building makes this all worthwhile!

So as you develop, keep in mind that this is alpha software.  If you’re running into problems with something, please let us know so we can set you on the right path and improve things for the next release.  If you’ve got the Axiis swc sitting on your machine, build something cool, tell us about it, and let us know what went right/wrong.  If you haven’t downloaded the swc, you can get it here.

You can get in contact with us by emailing tom or michael [at] axiis.org or direct a tweet towards @Axiis_DataViz.

Posted in Axiis, Flex, Information Visualization | Leave a comment

Axiis - A different kind of data visualization framework

Last week Tom Gonzalez wrote a blog post announcing Axiis, the open-source data visualization framework we’ve been developing. Tom goes into a good deal of depth about how the system works, so I won’t rehash all those specifics here. I just wanted to share my take on what Axiis is meant to do at a high level.

Axiis is not a reimagining of the Flex charting framework or any other comparable library.  Axiis can be more accurately described as a data-driven layout engine for Degrafa geometry.  We see the primary use of this engine being data viz, so we’re billing it as a data visualization framework.

So what do I mean when I say “data-driven layout engine?”  When using Axiis, you describe the geometry necessary to render a single element in your data set.  The engine then iterates over the entire data set, creating and laying out all necessary instances of that geometry.  This process allows you to create seeming complex visualizations in a relatively short amount of markup.

Take a column chart as an example.  (Though not all that complex, it still takes a fair bit of code to write a column chart from scratch.)  A column chart is simply a series of rectangles laid out horizontally where each rectangle’s height represents the value it is rendering.  So to create that in Axiis, you declare a horizontal layout with a rectangle geometry.  You then set up a binding expression to compute the height for each rectangle.  As the engine runs the binding expression executes, and the geometries are rendered side by side and with correct heights.  Huzzah!

The column chart is just a basic example.  Axiis is capable of much more than simple Cartesian charts.  Layouts can have child layouts as well.  This allows you to iterate over the top level of your data set in a parent layout and then iterate over another property in the child.  Tack on Degrafa’s ability to compose geometries, and you’ve got the tools to create very expressive visualizations.  Tom has put together an example he calls the Stacked Wedge that demonstrates nested layouts and geometry composition.  It represents data in a way that would be difficult to achieve with other frameworks, it looks beautiful, and the core of it is only 100 lines of markup!

Axiis is under heavy development, and it is rapidly approaching an alpha release.  Keep your eyes here and on Tom’s blog over the next few weeks for news and examples of the full scale of Axiis’ capabilities.

Posted in Axiis, Flex, Information Visualization | 1 Comment

Hit detection on graphics primitives: Speeding up the Parallel Coordinates Plot

In my last post I mentioned that I had rewritten the Parallel Coordinates Plot to achieve a pretty drastic speed up. Before I get into the graphics hit detection trick at the heart of the performance boost, I’d like to explain the problem with the original implementation. The main thing that dragged down the first version was the fact that each line drawn on the plot was handled by a separate UIComponent.  I knew that that was bad idea going in, but I went with it anyway. My reasons for subclassing UIComponent were pretty weak…

  1. I wanted to take advantage of invalidation.

    In most cases Parallel Coordinates Plots contain hundreds, if not thousands, of lines. The overhead involved in instantiating and validating thousands of UIComponents outweighs the programming convenience provided by invalidation, especially when all you really want to do is draw a line.

  2. I wanted the lines to have tool tips.

    It’s great that UIComponents have tool tip functionality built right in, but again, it’s foolish to take advantage of the niceties of UIComponent at the cost of performance.  The ToolTipManager exists for a reason.

  3. I wanted to allow the user to draw anything they wanted between the axes.

    Honestly, Parallel Coordinates Plots are crowded enough by default. I can’t think of a single thing a user would want to do aside from changing the color and thickness of the lines.

So for the most part I made the decision out of laziness.  When I started cleaning up the code to migrate it into BirdEye, I realized that I would have to rewrite the Parallel Coordinates Plot altogether if it was going to be useful to anyone.

Cutting out the bloat

With the overhead of UIComponent mind, it might seem reasonable to just make each line a Sprite and manage rendering manually.  Unfortunately, that probably wouldn’t scale nicely either.  Sprites are lighter than UIComponents, but adding thousands of Sprites to the display list and running graphics operations on them is still a tall order.

Drawing all of the lines to a single Sprite’s graphics property is straightforward enough, but all those graphics operations wear noticeably on performance.  This is the option I ultimately went with, so to get around the performance problem I store the results of the graphics operations to a BitmapData using the BitmapData.draw method and then render the BitmapData to the screen using Graphics.beginBitmapFill.

Unfortunately, this leaves the lines completely non-interactive.  They’re not DisplayObjects anymore, so they can’t dispatch the mouse events needed to support roll over and selection.  But wait…

Supporting bitmap interactivity using picking techniques

3D engines have to deal with this problem all the time.  When you click on the screen in an OpenGL application, the app knows the coordinates of the cursor, but the developer still has to do some leg work to figure out which 3D object those coordinates refer to.  There are a number of techniques used to solve this “picking” problem.  One technique is to render the 3D scene twice: once normally and once with each 3D object colored with a unique color.  The first rendering is presented to the user, while the second is kept invisible.  When the user clicks on a pixel in the first rendering, the program looks up the color at the cooresponding coordinates in the second rendering.  Since the colors are uniquely mapped to the 3D objects, this program can determine which object was clicked based on that color.

This is the same technique that the new Parallel Coordinates Plot uses to determine what the user is interacting with. Each line segment is uniquely identified by two fields and the values in those fields; the fields determine the x coordinates of the line segment’s endpoints and the values determine the y coordinates.



The Parallel Coordinates Plot maintains a hash mapping those four properties to unique colors. When the user clicks on the component, the color under the pointer is extracted, the hash is queried, and the items that match the field-value pairs are returned. In the full implementation there are four bitmaps used in all:

  1. The first bitmap contains a line for every item, regardless of selected or rolled over status.
  2. The second bitmap only shows lines for rolled over items.  This bitmap is rendered on top of the first bitmap, masking the fact that every item is actually rendered in the first one.
  3. The third bitmap shows only the selected items.  Similarly, this is rendered on top of the second bitmap to achieve the same effect.
  4. The invisible fourth bitmap used for picking.

It may seem redundant to render lines more times than absolutely necessary, but the extra steps let the Parallel Coordinates Plot save in the long run.  It only needs to redraw the lines that have changed from one moment to the next.  If the contents of the data provider and the width and height remain constant, the first bitmap only needs to be drawn once.

When it all comes together, the Parallel Coordinates Plot looks like this under the hood:




but the user sees this:



I’ve put together an example that demonstrates the new and improved Parallel Coordinates Plot. I didn’t run any metrics to try and compare the performance with the older sample I put together, but in terms of responsiveness, the new version blows the old one out of the water.  The source for the new sample is available here. The color hashing occurs within the internal FieldValuePairColorHash class at the bottom of the ParallelCoordinatePlot class.

Posted in BirdEye, Flex, Information Visualization | 6 Comments

Collaborating with BirdEye

BirdEye is a project that aims to be a comprehensive collection of visualization components, and I was recently asked to join the team.  I’ve added my components into the appropriate sub-projects; The Heat Map is in GeoVis and the Comparison Matrix and Parallel Coordinates Plot are in QaVis.  During the migration process I fixed a few bugs, and overhauled the Parallel Coordinate Plot entirely (more about that in a future post).  All future development on these components will occur within BirdEye, so that’s where you’ll want to go to get the freshest code.

Be sure to check out the QaVis and the GeoVis Explorers.

Posted in BirdEye, Flex, Information Visualization | 1 Comment

What I’m doing with my final semester

I’ll be receiving my MS degree in Computer Science at the end of this semester.  I finished my degree requirements last semester, but my timing on some of those requirements was a little funny, so I wasn’t eligible for graduation at the time.  In order to graduate this semester, the University requires that I be enrolled in at least one course, and there are no restrictions as to what that course has to be.  Back in my undergraduate days I worked with Doug Hamilton in the Astronomy Department on a solar system visualization, and to fill that one course requirement, I’m going to be bringing that project into the third dimension.

I was in registration limbo with the Astronomy Department for a few weeks, so I registered for PHYS104 How Things Work: Science Foundations as a safety course.  PHYS104 would have been *entertaining*, but suffice it to say, I’m glad to be doing something useful with my time.

I’m still working with the CATT Lab as a research assistant, but at 20 hours/week I have a lot more time on my hands than I’m used to.  I’ve been able to pick up some contracting work here and there, and I’m getting a bit more involved in some projects in the Flex community.

It’s going to be a fun couple of months.

Posted in School | Leave a comment

Visualizing the 2008 NFL Season

Super Bowl XLIII is less than two weeks away, so it feels like an appropriate time to look back at the statistics that were so diligently recorded during this past football season.  I’ve put together a comparison matrix based on data from pro-football-reference.com.  For first time visitors, a comparison matrix processes multidimensional statistics, looking for correlations, and lays out the results in a color-coded grid.  In this example, red indicates a positive correlation between the two crossed fields and blue indicates negative.  The deeper the color, the stronger the relationship between the two fields being compared.

You can view the interactive version of the matrix here.  View source is enabled.

I’m not much of a football pundit, so I’m not going to try to make too many insights into the data.  It did strike me as interesting that there is a weak or negative correlation between rushing and passing statistics.  It seems that teams with better throwing games tend to prefer to throw the ball over running it.  (Yeah, that was about as insightful as “The team that scores the most points usually ends up winning…”)

In this version of the comparison matrix, I introduced an item renderer which shows a snapshot of each of the plots.  The updated code can be checked out from my repository.

Posted in Flex, Information Visualization | 1 Comment

My app was just on TV

CNN just did a piece on the influx of people into DC for the inauguration.  Several of the tools the CATT Lab has developed are going to be used to help manage the traffic problems that are guaranteed to crop up as a result.


It’s a quick spot, but around the one minute mark you’ll see some of those tools, including my baby, the Incident Timeline.  The Timeline lays out every action that’s been taken to clear a traffic accident scene along a temporal axis so traffic operators can quickly discern what’s going on at the location.  Without the Timeline, the operators would be stuck looking at a list of timestamped descriptions, and that’s not really ideal when quick decision making is key.

Also featured are the lab’s travel time prediction tool and a Google Earth-like application we like to call the Virtual Helicopter.

Posted in Uncategorized | 1 Comment

The ComparisonMatrix component… or Playboy Playmates and the Economy

One of the challenges of information visualization is to present data in a way that allows the interesting patterns to rise to above the noise.  The ComparisonMatrix allows users to quickly assess where these patterns are so they can make an informed decision about where to start exploring.  To do this, the ComparisonMatrix breaks a multidimensional data set into all of the possible pairs of attributes and evaluates the relationships between those pairs.  The relationships are rendered in a grid where the cell at the intersection of the column labeled “X” and the row labeled “Y” shows you the relationship between X and Y.  The cells are colored to provide a quick visual cue as to which relationships are most interesting.  This is similar to the rank-by-feature prism found in HCE.

How about an example?

In 2004 Terry F. Pettijohn and Brian J. Jungeberg looked at the relationships between the physical features of Playboy’s playmates of the year and the economy.  I grabbed the csv for the playmate data off of Flowing Data, added a few fields to it, and dropped it into a ComparisonMatrix (view source enabled).  Pink represents a positive correlation while yellow represents negative.  The deeper the color, the stronger the relationship.  You can click on a cell in the matrix to bring up a scatterplot of the data set based on the two selected attributes.

The strongest relationship in the playmate data set is actually between GDP and year, so that makes it somewhat difficult to make any assertions about trends in the playmates’ physical features and the economy while not making the same assertion about those physical features and time.  (The authors of the paper actually used something called the “General Hard Times Measure” to evaluate the economy, and it looks like GDP isn’t really equivalent).  Despite this problem, the ComparisonMatrix still provides some interesting information about the playmates.

  • The playmate’s heights, weights, and waists are all correlated.  These women have roughly the same figures, just scaled up and out differently.
  • The playmates’ bust to waist ratios have decreased with time while their waist to hip ratios have increased.
  • BMI, though being a function of height and weight, is more strongly correlated with hip size than height.
  • There is no relationship between the age at which these women claimed their titles and their hip sizes.  That’s right, if you have nice hips, it might not be too late too be a playmate.

Using the ComparisonMatrix

Like all my stuff, the ComparisonMatrix is under the MIT license, so you can use and adapt it in whatever way you like.  The code is documented pretty thoroughly, and the source of the playmate example is pretty useful for getting started.

In terms of usage, all you need to do is supply the ComparisonMatrix with the data set you want to analyze (the dataProvider property) and the array of attributes it should consider (the fields property).  Given those two properties, the ComparisonMatrix will be able to render your data, though there are a bunch of other options available.  Take a look at the documentation in the code for details.

The default comparison function is the correlation coefficent.  As a result, the default behavior is to expect comparison values from -1 to 1.  Since the ComparisonMatrix allows you to plug in your own comparison function, you’ll have to provide your own color and alpha functions if you want to use a different scale.

I made an effort to make the renderers (the actual cells in the grid) as flexible as possible so you can write your own without rewriting the ComparisonMatrix itself.  To do this, write a class that implements the IComparisonRenderer interface and set the comparisonRenderer property to be a factory for that class.

The next step

Statisticians and information visualization researchers have developed a slew of measures for determining interesting relationships between attributes in a data set.  Even though the ComparisonMatrix allows you to plug in whatever comparison function you want, I’ll probably build these in at some point for easy access.  As I make updates to this component, I’ll be committing them to my repository.  As a result, the example here will not always be the most up to date.  For the most up to date code, check here.

I have lofty dreams for this thing.  More later.

UPDATE (January 21, 2009)

I wasn’t kidding.  The ComparisonMatrix has changed a bit.  If you want the best matrix you can get, grab it from the repo, not the source of the swf.

Posted in Flex, Information Visualization | 2 Comments

How to check if you’re running a debug swf

There was a brief thread on flexcoders recently about how to check if an swf was built for debugging or for release.  With this check you can build all sorts of debugging diagnostics into your application and then compile an unaffected release build without changing any code.

There is no built in way to perform this check, so putting it modestly, the solution is a bit of a hack.  In a debug swf, the stack trace contains line number information that is absent in a release swf.  To check if you’re in debug mode, all you have to do is throw an error, catch it, and check the stack trace for the square brackets that surround the line numbers.

Here is a little class I wrote that will perform this check.

package com.michaelvandaniker.capabilities
{
    public class SWFCapabilities
    {
        private static var hasDeterminedDebugStatus:Boolean = false;
 
        public static function get isDebug():Boolean
        {
            if(!hasDeterminedDebugStatus)
            {
                try
                {
                    throw new Error();
                }
                catch(e:Error)
                {
                    var stackTrace:String = e.getStackTrace();
                    _isDebug = stackTrace != null && stackTrace.indexOf("[") != -1;
                    hasDeterminedDebugStatus = true;
                    return _isDebug;
                }
            }
            return _isDebug;
        }
        private static var _isDebug:Boolean;
    }
}

I’ve tested this class in the debug and release versions of Flash Player 10.0.12 and 9.0.124.

Posted in Uncategorized | Tagged | 3 Comments

Presenting at DC’s World Usability Day Event

Today is World Usability Day, and this year’s theme is transportation. I’ll be presenting the work I’ve been doing at the CATT Lab at DC’s local Usability Day event. The title of my poster is Real-time and Historic Incident Visualization Using Timelines, and it describes an application that allows users to understand everything that has been done to manage an accident scene by presenting all of the events along a timeline.

There are seven other people from the CATT Lab presenting their work as well. The majority of that work is in the realm of information visualization. If that’s your thing, and you’re in DC today, stop by the American Institute of Architects and see what we’ve been up to.

Happy World Usability Day, everyone.

Posted in Uncategorized | Leave a comment