Treemap

From J Wiki
Jump to navigation Jump to search
Treemap.png

A treemap paints a list of data as rectangles in the graphics window, where each rectangle has area proportional to its value. Rectangles at top left are the largest, and at bottom right, the smallest. Such a display makes it obvious which are the largest items and their relative sizes.

The squarified algorithm is used, see Wikipedia.

Colors can indicate other attributes, e.g. if the data has both negative and positive values, then red/green could indicate sign. When data is all positive or all negative, then color could indicate parent. A hotkey might toggle through different color schemes.

Moving the mouse over a rectangle can display information for that cell.

Treemap Verb - the treemap verb can be used to display simple treemaps from the J ijx window, see:

  • Verb - the treemap verb

Documentation  - for using treemap in an application

Example

Download the treemap addon, then enter:

load '~addons/graphics/treemap/demo.ijs'

Press New Run to generate a new set of random data. Resize the display to see that the arrangement of rectangles changes to match the window size. Note that information is displayed as the mouse is moved over the rectangles.


See also

Wikipedia


Contributed by Chris Burke.