Squarified Treemaps with source !!

Treemaps (sometimes called heatmaps) are one of my favorite data visualization techniques, and it has taken me a while to finally figure out how to do them. The idea is simple: Each component is represented by a rectangle whose area is proportional to the ‘weight’ or relative importance of the item. I finally did find a technical paper on the idea and have implemented it in my source code. The algorithm efficiently finds what the best dimensions should be for the rectangle keeping its length-to-width ratio as close to one as possible. The demo application reads Digg’s music news feed and draws rectangled based on the number of diggs each entry got. To really play with the application, resize the container and see the application redraw itself to respond to the change in dimensions. I think the coolest part of the code is the fact that the drawing part is fairly abstracted from the logic that computes the sizing. So to create your own ‘renderer’, all you have to do is extend the HLayoutManager and the VLayoutManager and override the draw method.

The code is released under the MIT liscense, so feel free to use it.

The DiggReader application can be seen here and the source can be seen here. Use the DiggReader.as as main class of the DiggReader application

5 Comments so far

  1. [...] This is cooooool. FlexBox features my Squarified TreeMaps code. Plus FlexLib has the SuperTabNavigator component that Doug McCune developed using my earlier closeable / draggable Tab Navigator class. So my ‘six degrees of separation‘ has Mike Chambers,Ted Patrick, Doug McCune and Darron Schall. I am psyched !!! [...]

  2. spditner on April 29th, 2007

    Was thinking of incorporating some of this into the perl treemap library — but the download .zip link seems to be broken :-/

  3. Brendan Dawes on September 26th, 2007

    Hi,

    would love to use the reemap source but the link seems broken – any chance of a fix? Thanks.

    Bren.

  4. arpit on November 5th, 2007

    oigg….sorry about that. I am afraid the treemap code is in the middle of some uber refactoring. Once I have it stable again, I’ll fix the link.

  5. [...] Arpit Mathur :: Squarified Treemap :: More info [...]

Leave a reply