- I
Remarks
Layout Style
Tree maps are suitable to visualize hierarchical data structures. They use nested rectangles to do so, where the size of the rectangles encodes its weight. More generally, the area of a rectangle is proportional to a specific dimension of data associated with it.
Tree maps can, for example, be used to show a file structure on a hard disk, where the dimension of data is the size of the files/folders. There are many other use cases where the tree map can show the distribution of the dimension of data among the entities in a hierarchy.
Concept
TreeMapLayout offers implementations of the well-known treemapping algorithms Slice-and-Dice and SQUARIFIED. These tiling strategies divide a rectangle with a given size into multiple sub-rectangles. Speaking in terms of graphs, this means that nodes are placed in a nested fashion such that child nodes are placed inside the parent node.
Importantly, node sizes are changed by this layout algorithm to show the proportional weight of a node in the map. The weight is specified via layout data property nodeWeights.
Features
The input can be specified in two ways:
- As a hierarchical grouping structure that defines the nesting. Note that for group nodes, the specified padding are considered (see GROUP_NODE_PADDING_DATA_KEY). If the graph is a tree graph, then the grouping structure is ignored - see second input variant. To continue using the hierarchy information of the grouping structure on a tree graph, one can temporarily hide the tree edges before running the layout.
- As a directed tree graph. The parent-child relation is directly taken from the graph's tree structure. If the graph also contains group nodes, the hierarchy relation induced by them is ignored. If necessary, an undirected tree can be (temporarily) directed prior to the layout run by using makeTreeDirected. The tree needs to be directed from the root (top-level hierarchy) to the children (lower-level hierarchies). Note that a forest graph is no valid input.
The offered tiling strategies produce drawings with a quite different style. SLICE_AND_DICE offers results that have a stable, clear ordering but the rectangles have a high aspect ratio. On the other hand, SQUARIFIED tries to create rectangles close to a given aspect ratio - in consequence, the ordering of neighbor nodes might not be clearly predictable.
Default Values of Properties
| Name | Default | Description |
|---|---|---|
| minimumNodeSize | Size | Minimum width and height are 10.0. |
| preferredSize | Size | Preferred width and height are 600. |
| spacing | 5 | |
| tilingStrategy | TilingStrategy.SQUARIFIED |
See Also
Developer's Guide
Members
Constructors
Initializes a new instance of the TreeMapLayout class with default settings.
Parameters
Properties
Gets or sets the target aspect ratio of the SQUARIFIED tiling strategy.
The aspect ratio must be greater than or equal to 1. A ratio of 1 means that the node rectangles should ideally be squares. The orientation of the rectangles does not matter. For example, a ratio of 2 means that rectangles with an aspect ratio of 1:2 or also 2:1 are desired.
This setting affects the ratio of a single node rectangle. To create a tree map with a certain overall aspect ratio, the preferredSize can be specified accordingly.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the given aspect ratio is smaller than
1
Default Value
See Also
Developer's Guide
API
- SQUARIFIED
Gets or sets the minimum size (height and width) a node in the tree map must have.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the width or height of the given size is smaller than
5
Default Value
10.0.See Also
Developer's Guide
Gets or sets the desired dimension of the root rectangle into which all nodes are placed.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if width/height value of the given size is less than or equal to
zero
Default Value
600.See Also
Developer's Guide
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the given spacing is negative
Default Value
Sample Graphs
5See Also
Developer's Guide
Gets or sets the TilingStrategy that defines how the input is divided into sub-rectangles.
Property Value
Default Value
See Also
Developer's Guide
Methods
Arranges the given input graph as a tree map.
Parameters
- graph: LayoutGraph
- the input graph
Implements
ILayoutAlgorithm.applyLayoutcreateLayoutData
(graph: LayoutGraph): TreeMapLayoutData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the TreeMapLayout.
createLayoutData
(graph: LayoutGraph): TreeMapLayoutData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>Parameters
- graph: LayoutGraph
- the graph that determines the generic type arguments of the created layout data
Return Value
- TreeMapLayoutData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>
- an instance of layout data that can be used to perform item-specific configurations for the given TreeMapLayout.
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the TreeMapLayout.
LayoutExecutor type is available at runtime.Parameters
- graph?: IGraph
- the graph that determines the generic type arguments of the created layout data
Return Value
- TreeMapLayoutData<INode, IEdge, ILabel, ILabel>
- an instance of layout data that can be used to perform item-specific configurations for the given TreeMapLayout.
See Also
Developer's Guide