This project provide a small API to build hierarchical visualization using the Pharo programming language. HierarchicalVisualizations uses Roassal.
Execute the following code snippet in a Playground:
[ Metacello new
baseline: 'HierarchicalVisualizations';
repository: 'github://NicolasAnquetil/HierarchicalVisualizations:main';
load ] on: MCMergeOrLoadWarning do: [:warning | warning load ]
Consider the following code snippet:
node1 := HNode new name: 'Node1'.
node2 := HNode new name: 'Node2'.
subnode1 := HNode new name: 'Sub1'.
subnode2 := HNode new name: 'Sub2'.
subnode3 := HNode new name: 'Sub3'.
subnode4 := HNode new name: 'Sub4'.
node1 addAll: {subnode1. subnode2}.
node2 addAll: {subnode3. subnode4}.
rootNode := HNode new name: 'Root'.
rootNode addAll: { node1. node2 }.
subnode3 dependenciesToNodes: { subnode1. subnode2 }.
rootNode open.
The code above defines four nodes in total, structured as a hierarchy. Executing the code should shows:
Node can be collapsed or expanded:
New menu items can be defined by creating a subclass of HAbstractMenuItem
. The package Hierarchical-Roassal3-Menu
contains many examples on how to define a new menu item.
An example of a Heat map extension for a Famix model
. "Intensity" of fanout
is indicated in red:
HHeatMap new
elements: model allModelClasses ;
colorMin: (Color fromHexString: #FFF0F0) ; "VERY PALE red, default is white"
colorMax: Color red ; "this is the default anyway"
property: [ :clazz | clazz fanOut ] ;
open.
An example of a DistributionMap for a Famix model
. There are four categories according to the number of methods in the class (less than 5, 6 to 10, 11 to 25, more than 25). Categories are colored according to a red/gray map (RSColorPalette diverging rdgy4
) :
HDistributionMap new
elements: model allModelPackages ;
childrenBlock: [ :pckg | pckg allClasses ] ;
propertyBlock: [ :clazz |
{ 0 -> (0 to: 5) .
1 -> (6 to: 10) .
2 -> (11 to: 25) .
3 -> (26 to: 999999) }
detect: [ :cat | cat value includes: (clazz numberOfMethods) ] ] ;
colorMap: RSColorPalette diverging rdgy4 ;
open.