Browse DevX
Sign up for e-mail newsletters from DevX


Make Your Java Data More Useful with Treemap Visualization : Page 2

Using visualizations such as pie charts and bar graphs to present data is nothing new. But what happens when you've got more data points than a pie chart can render? Enter the treemap! Use JTreemap to create your own Java Treemap application and render any data you like.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Making the Case for Advanced Visualization
What would happen if you wanted to view data from every country in the world, broken down in the same way? Would you have a page showing hundreds of pie charts? How would these pie charts relate to each other?

These are the problems that the treemap visualization has been designed to solve. The treemap allows you to render a complex, hierarchical dataset in a relational view. It is capable of plotting many data points and keeping it visually consistent. An example of a treemap in commercial use is SmartMoney.com's Market Map, which takes the instruments that are in the S&P 500 index of stocks and creates a treemap.

On this treemap, the market is divided into sectors. Each sector has a number of stocks. The area of the sector is divided up into a number of rectangles with the size of the rectangle being directly proportional to the market cap of the company (the market cap is the number of shares available times the price of a share). The color of the rectangle shows the current change in price. Hovering over a rectangle shows more detail on the company in question.

As you can see, a vast amount of information is presented to the user:

  • Company placement by sector
  • Market cap of every company in the index
  • Current status of the stock (up/down) every company
  • Overall view of the market today
  • Overall view of every sector today

This is an incredibly useful tool. On any given day, you can easily see which sectors and companies are doing well, and which are doing badly.

In this article, you'll use a similar visualization technique to build an application that renders whatever data you like.

Various Java Treemap Visualizations

Figure 2: This is the University of Maryland Treeview visualization.

The homepage of the original Treemap work is at Ben Schneidermann's at the University of Maryland, and it may be found here. His implementation, which generates a treemap of the contents of a specific directory on your hard drive may be downloaded from this site. Figure 2 shows a screenshot of the output of this treemap.

In addition to this one there are a couple of excellent open source offerings available on www.sourceforge.net. This Java Treemap, for instance, provides some excellent options on how to present your treemap. A screenshot from this version is shown in Figure 3.

Figure 3: Here is the Java Treemap screen capture.

JTreemap is another available open source Treemap application. Though written in French, it's very flexible and easy to use. In the sourcecode for this article, I have included a version of its XML instance document and schema translated into English, as well as one of the Java modules of the original download. If you aren't comfortable with the French software, you can use these versions.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date