Archive for the Category Component Development

 
 

Axiis – New data visualization framework

axiis_logo

Well, I guess it is time to finally let the cat out of the bag.  For the past few months Michael VanDaniker and I have been working away on a new open source project we have named Axiis (you can thank Juan Sanchez for the great name.)   We are still a couple months away from our first public alpha release, but I think it is worthwhile spending some time to discuss the details of what we have been developing. 

Axiis represents a new way to conceive of and develop interactive data visualizations.   It is based on Flex and ActionScript 3.0 but has a uniquely different approach to creating visualizations than the standard Flex charts, and pretty much any other data visualization package I have seen.  Our primary goal in developing Axiis is to create very concise, expressive, and flexible framework that uses a purely declarative (markup) based approach to create anything from simple cartesian charts to very complex and involved data visualizations.  


Den ganzen Beitrag lesen…

US Trade Deficit Visualized

This data visualization design study is the first in (hopefully) a series of visualizations depicting US and Global Finance information.  My original goal was to tell a compelling story with this visualization, and stay true to many data visualization best practices.   But somewhere along the way, the artist in me became more absorbed in the aesthetics than the underlying story, and I abandoned many of the best practices I had hoped to employ.

As a result I think the data visualization still works for the main trends.  You can see annual trade surplus/deficit information for each of the top 10 countries for each (surplus/deficit.)  The countries that are in surplus (adding cash to the US Economy) are along the top, while the countries along the bottom show the corresponding trade deficits (that are taking cash out of the US Economy.)    It is pretty obvious that overall the US has far more deficit than surplus trade, and by a huge margin, and that in later years the US deficit with China is pretty large.

I did spend a fair amount of time working on a simple algorithm that represents the flow of cash as various weighted lines for each country (as shown in the top right legend.)  Visually I believe you can get a rough at-a-glance view of how much cash is flowing from each country, while still having enough fidelity at the lower volumes to discern differences between those volumes, since in essence it is a log scale in stroke weights.

I had played around with animating the flow of cash monthly so you could see it funneling from the surplus countries to deficit countries, but I started to hit too many performance issues with the animation, and I thought this version was a good stopping point.

On the technical side, this is pretty much pure Degrafa GeometryRepeaters and CubicBezier curves.   One of the most elegant things about this visualization is that the core code that maps the visual structures is less than 60 lines of Degrafa MXML.

At some point in the future (perhaps 360|Flex in Indianapolis) I will open up the source code and walk through how it is done.   Suffice to say that I am 100% convinced that using markup to create your composite visual structures and procedural code to tweak them is a much more effective and intuitive way to code than using a pure procedural/OO approach.

After spending a fair amount of time working with Processing, which is pure OO/Procedural coding, getting back to Degrafa was refreshing change.  Things like the GeometryRepeater class are extremely powerful for this type of work – especially when you bind it to dynamic data sets.   Being able to use markup to make contextual relationships in XML to your visual forms is extremely helpful for keeping all of your abstractions front and center mentally.  With complex visualizations and lots of composite pieces the human brain (especially mine) is limited as to how many abstractions it can keep in working memory at any one given time.   By being able to describe your structures declaratively in a concise amount of space, you can then manipulate specific properties of that structure while still being able to reference the whole.   This allows me to “sketch” in my major graphic forms and then later add details, animation, and styles to each piece of the form.

MAX 2008 Data Viz Source Files

I just got back from my trip up to San Fran, for Adobe MAX 2008, and I wanted to post the source code for my session on Data Visualization.   My preso was geared to target a broad spectrum of developer levels from beginner to advanced.  I have four code demos that cover off on data structures for charts, data formatting, chart styling/appearance, and chart interaction.   Each demo walks through a progression from simple to advanced concepts and code.   From the session feedback survey feedback I received today, it appears that audience found the presentation helpful and valuable as I had relatively high marks, and few people told me it was one of the better presentations at the conference.   To everyone who attended, thanks for coming, and I hope you got some value out of it.

Here is the link to the source files.

Overall I found the conference as a whole to be a bit of a let down at the content level.  It was great to see all the familiar faces and catch up with people, but I didn’t have the same feeling of excitement that I had last year in Chicago.  It seemed this year that Adobe was doing a lot more product refinement than pushing any real new boundaries.   Flash Catalyst (Thermo) has not really changed (just gotten further along) than what we saw in Chicago last year, and overall the MAX “Sneaks” were rather blah… ActionScript on the server to render HTML… c’mon guys we were doing that kind of stuff with .asp 10 years ago.   I sure hope MAX last year was not the apex of Adobe under the guidance of Bruce Chizen, and that now we are starting a decline.    I also realize that Adobe/Macromedia has pushed so many boundaries over the last couple of years that as a company it is now in a position where it needs it platform technologies to cross the chasm from early adopters to a more mainstream market, which for people like me becomes boring – because I always want to work with new technologies and be that early adopter level.

My speaking schedule at MAX 2008

Monday November 17th is the official start date for Adobe MAX.   I will speaking at several sessions throughout the conference.

On Monday I will be speaking with Juan Sanchez about Degrafa at the 360|MAX unconference.  The presentation will be from 4:00pm to 5:30pm.

Then Monday night at 9:30 I will be doing a Birds of a Feather session with Juan, speaking again about Degrafa.

Wednesday at 3:30pm I will be doing my Flex Data Visualization presentation.  Adobe asked me to do this preso and to try and serve as wide an audience as possible from Flex rookie to advanced Flex developers.  60 minutes is not a lot of time so I will be moving quickly and I have put together 4 new code demos where I walk through code from simple to advanced examples that cover off on  Data Structures, Working with Chart Series, Styling Charts, and Chart Interactivity.   Pretty much everything is focused on Flex charting, versus other components.  I will also be covering off on some of the open source components I have previously released like the DataSet Component, as well as one or two new components I have created that make it easier to customize Flex Charts.

I hope to see you there, and please don’t be shy about introducing yourself if you have read this blog.   MAX is a really fun conference and I am looking forward to it.

 

UPDATE 11/14/2008:  According to the MAX scheduler it says my session is SOLD OUT, but don’t worry if it is like any other MAX event it is first come, first serve – so just be there early.   I also realized the session description is slightly different than the content.  It is hard in 60 minutes to get too in depth about anything, my session will show different techniques for dealing with data, chart appearance and styling, and user interaction within Flex charting.

360 Flex Data Visualization and Dashboard Presentation

At 360 Flex San Jose Adobe (Ted Patrick) recorded all session presentations in HD with sound.  Today they just published my preso.   Unfortunately my laptop was giving me fits and I could never get Keynote to go into “presentation” mode.   Outside of that and a lot of “umm and uhhs” while I was talking the presentation did a pretty good job of presenting the material and giving the community some new MIT code.   You can also see it via Adobe Media Player to get the full rez version.

Chart Slicer Component Released

Today I am releasing a chart slicer component that behaves like the one seen on Google Finance.

I had several requests for the source code for my Google Finance sample, but regretfully the code is embarrassingly sloppy, and I am not sure when I will be getting back to cleaning it up.  One of the components within that example is this chart slicer control, which I have now created a simple example for, with source code included.
This control can target any Flex cartesian chart, although I have only tested it with a few, so I am sure people will find edge cases (or perhaps not so edge cases) that break the component.   It is easy enough to change the display in the control from an area chart to any of the MicroCharts included with a little customization.
This component has a liberal use of Degrafa to make all the magic work, from custom skins on the sliders, to the microcharts used to represent the data, to the tick marks within the slider track the reference the positioning of the items in the target chart.  You will also notice some extra logic that has the sliders snap into alignment with the actual item renderers of the target chart.   With larger data sets this is less noticeable, but with small ones it is very effective.   
Many thanks to Doug McCune for his HSlider control, and the efforts put forth by Brandon Meutzner.
You can see the example and download the code here.   As usual all code is released under an MIT license.

360 Flex Data Visualization Code Examples

This is a pretty short post that I wanted to get out to the community.  Below are the links and source code (view source) for the presentation I gave today at 360 Flex in San Jose. 

GoogleFinance Example: (view source coming soon, still needs some refactoring and clean up.)

Gauge Component – New Features – v04

First a thanks to everyone who has commented and used the previous versions of the gauge component seen here.
A few weeks ago a publicly traded company (that has asked to remain anonymous) hired me to make some improvements to the gauge to meet some of their specific needs.  Some of the improvements are things that other people had asked for, so I offered to give them a discounted rate if we could keep the improvements under the original open source license.   It was more important to me that I be able to share the enhancements with the community than the additional revenue I would have generated to lock up the intellectual property.
So here is a list of the latest enhancements.
1. Bounce Effect can now be set on/off by a boolean useBounceEffect. (code changes in control.)
2. Tick Mark Alignment Fixed – Tick marks for the gauge skin now use a best fit algorithm to align exactly with the min/max angles (before they sometimes would not cover the full range. (code changes in skin)
3. A X-Offset style has been provided for the value label placement (code changes in skin and control)
4. Alert Levels: A popular request was the addition of alert levels, something that I had in the original gauge I built.  The gauge now supports contiguous alert levels by passing it an array of alertValues, alertColors, and alertAlphas.   The control expects that the alertColors and alertAlphas will have one element less than the alertValues, since the alertValues contains the additional min or max boundary element, and the colors/alphas apply to the range within the boundary described by the alertValue array. (code changes in skin and control)
5. Log AND Linear scale: This was by far the most complex enhancement.  The gauge now supports movement through a log scale as well as the original linear scale, and since my math skills seem to be stuck somewhere between 8th grade trig and 9th grade algebra it took me a while to figure out the algorithm to support not only programatic value assignments, but also when a user clicks along the  and sets the value directly – yes now I remember that, Math.pow(10,value) is the inverse of Math.log(value)/Math.LN10 :)   This log scale also gets applied with the alert ranges, and the skin leverages the now public caclulateAngleFromValue() function exposed by the control itself – which takes into account the min/max value range, the min/max angle range, AND the linear or log scale. (code changes in control)
I have tried my best to run it through a bunch of tests and ferret out any bugs, but if anyone finds something I missed please post and comment, and I will try my best to fix or point you in the right direction.  Once again this code is posted under the every friendly MIT license.
Check out the sample here, with full source code.

Note: This gauge uses the latest version of Degrafa Beta 3, please reference the included .swc – as older versions of degrafa will cause conflicts.

New Degrafa Repeaters

One of the first areas of Degrafa I started working on was a revamp of the current Repeater objects.  Jason had some cool ideas on what we could do to make repeaters more concise, flexible, and powerful.   After a couple of IM chats I had a reasonably good idea of what we wanted to accomplish and I rolled up my sleeves to see what I could do.   You can see the most current rev in our Dev branch at Google Code, although I suspect we will end up cleaning up some of the name spacing and move the new GeometryRepeater class somewhere else.
One of the challenges the current Degrafa Beta 2 suffers from is that we have a myriad of specific geometry repeater classes like Line, Circle, Rectangle, etc…    Not only does this clutter up our core class libraries, but it is also much less flexible than it can be.
The new architecture we are developing takes a different approach, instead of creating gemoetry specific repeater classes we wanted to create an abstract repeater engine.   This is accomplished through our GeometryRepeater class which inherits from Geometry and implements the IRepeaterModifier interface via its modifiers array.  Okay, so what does this all mean?
1.  You define the geometry you want repeated with any number of Degrafa geometry objects, which can be separate objects or complex compositions.   You are no longer limited to the current repeater classes, but can easily repeat ANY Degrafa geometry you create.
2. You define HOW the geometry repeats via one or more IRepeaterModifiers.   Initially we have created a PropertyModifier that allows you to target one or more geometry objects within your GeometryRepeater and an associated property you want to modify.  You can have as many RepeaterModifiers as you want to create composited repetitions.  Over time we may add additional core modifiers, or you can create your own by implementing the IRepeaterModifier interface.
Below you can see how one might implement a Circle repeater that repeats along a horizontal Axis:
<GeometryRepeater>
<Circle radius=”30″ centerX=”10″ centerY=”10)”/>
<modifiers>
<PropertyModifier property=”centerX” offset=”10″ offsetOperator=”add”/>
</modifiers>
</GeometryRepeater>
For a more complex example you can check out this demo that has view source enabled.
When you look at the demo you will see a simple circle geometry that is being repeated 30 times with multiple property modifiers being applied to it.  If you look at the code there are some interesting things to note here about the PropertyModifier class.
1.  We support targeting common properties across multiple targets via just one repeater like are doing here with the myCircle and myRect in the targets properties.  We also support not only direct object properties, but also descendent properties via a dot notation (look at the property=”fill.alpha”) setting for example:
<PropertyModifier targets=”{[myCircle,myRect]}” property=”fill.alpha” offset=”.01″ offsetOperator=”add”/>
2. We support built in static operators as well as offset functions.
Not only can you provide static offset amounts (as in the example above) with fixed operators like add, subtract, or none you can also provide offsets as an array that will behave like a modulo function against the iteration number as in the radius modifier below.   Additionally you can also provide offsets as dynamic functions as in the fill.color modifier that uses the custom colorOffset function found in the sample source files.
<PropertyModifier targets=”{[myCircle]}” property=”radius” offset=”[5,4,3,2,-2,-3,-4,-5]” offsetOperator=”add”/>
<PropertyModifier targets=”{[myCircle,myRect]}” property=”fill.color” offset=”{colorOffset}” offsetOperator=”add”/>
There are many more advanced features, but I will wait until we have pinned down the exact functionality for our Beta 3 release before delving into it further.  Please check out the sample, and use view source to get an idea of what is possible.

Gauge Component v.02

After the response I received on the first release of the Gauge component I thought it was time for an overhaul of the code since this original code was written when I was learning Flex back on the alpha bits of Flex 2.0. Since that time Flex has moved on, and I have learned quite a bit.

This version of the component is a complete re-write of the code and is vastly simpler and easier to read/extend. First a thanks to Peter Ent, as his stab at a gauge was infinitely better thought out than mine and much more compact, the component code is very close to his, with a couple of modifications. The other bigger, and what I consider very significant change for this component is how it leverages Degrafa… which if you are not familiar with and you are doing any component development you are doing yourself a disservice by not taking a close look at it. I used this little mini project as an excuse to really dig in and find out what Juan, Jason and the rest of the Degrafa team had been working on since they seemed to be popping up everywhere.

When I dug into Degrafa I was REALLY impressed at several levels. Not only are the examples just plain sweet visually, but the framework itself is very elegant, compact, and infinitely extendable. In this version of the gauge I built two skins completely in Degrafa and MXML markup, you can toggle the skins and they will still respect the color of the styles you choose. BTW, the skins can be set via CSS, and you can have separate skins for each part of the gauge (bezel, face, pointer, center, indicators.)

The beauty of this approach with Degrafa is three fold. First I am using MXML to create complex geometric relationships which is infinitely easier to do in markup versus procedurally because the markup itself creates visual relationships through the inherent nesting and grouping structure of XML. Second, Degrafa does a great job of leveraging Flex’s binding mechanism, which in my opinion is one of the most powerful things within Flex. Finally the workflow is vastly improved, I can do everything from flex builder and not jump between Flash for building vector assets and exporting to symbol .swfs etc…

On some later post I will probably dive into the framework itself, since I ended up having to extend it in a couple of areas and it only took me a few minutes to do so. For example the “tick” marks you see on the gauge I ended up copying the VerticalLineRepeater which extends the base Repeater class, and within 20 minutes after modifying a few methods and adding a couple trig functions, I had this arc of lines that I could declare in MXML… I remember the first time I did that in the original gauge component it took me hours to fine tune procedurally via the API.

At Juan’s urging I wanted to get this up so it could be shared with the community, as such the code might stand a little clean up here and there, but overall it should be pretty easy to follow. I am also going to be writing an article for InsideRIA that goes into all the gory details of building out this component with Degrafa, which was actually quite simple and very enjoyable.

———————————————-
Caveat… The tweening of the pointer is a little flakey, as I threw it in at the last second, and I need to do a better job of handling the rotate effect and updateDisplayList collisions.

Update: The newest version of this component can be found here.