https://github.com/objectprofile/hierarchicalvisualizations
https://github.com/objectprofile/hierarchicalvisualizations
Last synced: 28 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/objectprofile/hierarchicalvisualizations
- Owner: ObjectProfile
- License: mit
- Created: 2021-05-02T11:01:50.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-19T14:24:59.000Z (over 2 years ago)
- Last Synced: 2025-01-19T14:22:02.473Z (about 1 year ago)
- Language: Smalltalk
- Size: 759 KB
- Stars: 5
- Watchers: 6
- Forks: 5
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Attention

WE ARE MOVING
- HierarchicalVisualizations => https://github.com/moosetechnology/HierarchicalVisualizations
# HierarchicalVisualizations
[](https://github.com/ObjectProfile/HierarchicalVisualizations/actions/workflows/runTests.yml)
This project provide a small API to build hierarchical visualization using the [Pharo](http://pharo.org) programming language. HierarchicalVisualizations uses [Roassal](https://github.com/ObjectProfile/Roassal3).
### Install
Execute the following code snippet in a Playground:
```Smalltalk
[ Metacello new
baseline: 'HierarchicalVisualizations';
repository: 'github://ObjectProfile/HierarchicalVisualizations:main';
load ] on: MCMergeOrLoadWarning do: [:warning | warning load ]
```
### Example
Consider the following code snippet:
```Smalltalk
node1 := HNode new name: 'Node1'.
node1 color: Color blue translucent.
node2 := HNode new name: 'Node2'.
node2 color: Color green lighter lighter.
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`](https://github.com/ObjectProfile/HierarchicalVisualizations/tree/main/src/Hierarchical-Roassal3-Menu) contains many examples on how to define a new menu item.
Roassal's layouts may be set in a `HNode`, as for example:
```Smalltalk
node1 := HNode new name: 'Node1'.
node1 layout: RSVerticalLineLayout new.
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 add: HNode new.
rootNode open.
```
which produces: