Shallow Rampa - TreeMap Haskell library

TreeMap Haskell library

by dixie on Date unknown

Tagged as: data, app, lib, tree.

Overview

treemap-html is Haskell library and tools for construction foldable HTML tree view.

For the details about real Treemaps see Wikipedia Treemapping

To be honest the library doesn’t construct the real treemap with sizes of rectangles on the map based on some node weight parameters. It is only nested boxes tree view and package names are unfortunately misleading.

Installation

On Linux use HackageDB as usually.

On MS Windows you can use also binaries, see dirmap.exe and xml2treemap.exe.


$ cabal install treemap-html $ cabal install treemap-html-tools

Please be aware that it is an experimental throw away software.

Usage of library

The function treeMap takes the Data.Tree with the String nodes and render it to the String with HTML elements.

Simple example which explain it:

import Text.HTML.TreeMap
import Data.Tree

exampleTree :: Tree String
exampleTree = Node "Slovakia" [
                 Node "Bratislava" [
                     Node "Petrzalka" [] 
                 ], 
                 Node "Zilina" [ 
                     Node "Hajik" [
                        Node "Mr. Cirman" [] 
                     ] 
                 ]
              ]

main = putStrLn (treeMap exampleTree)

Screen shot from Firefox (unfolded with clicks on the labels):

TreeMap Example

TreeMap Example

Usage of tools

Two basic commands provided:

  1. dirmap
  2. xml2treemap

dirmap

Creates tree view from the directory content.

Usage:


Usage: dirmap [OPTION...] directory -v --verbose verbose output on stderr -l Integer --level=Integer maxlevel for recursive directory listing -n Integer --name=Integer maximum size of filename. than truncation. -o FILE --output=FILE output FILE -f --files include files in listing -e do not included subtrees without files

Example usage:


$ dirmap -f -n 1000 -l 2 -o libs_l2.html /usr/lib

xml2treemap

Creates tree view from the XML.

Usage:

Usage: xml2treemap [OPTION...] <input file.xml>
  -v          --verbose       verbose output on stderr
  -o FILE     --output=FILE   output FILE

Example usage:


$ xml2treemap -o map.xml /usr/share/dbus-1/interfaces/org.kde.KWin.xml

Examples

The boxes are unfolded with mouse click on their text labels.

Linux source code dirmap

Linux source code dirmap

Hackage DB modules dirmap

Hackage DB modules dirmap

Ant Build XML with xml2treemap

Ant Build XML with xml2treemap

Download

Sources

Changes treemap-html

Changes treemap-html-tools