This layout algorithm places nodes in a tabular fashion.
Remarks
Layout Style
The nodes are placed based on an underlying PartitionGrid structure. Only nodes are arranged, edges are not routed, but their bend points are cleared. Therefore, this algorithm is suitable if nodes should be arranged in rows and columns in a regular fashion.
8
nodes organized in a 3x3
grid
8
nodes organized in a 2x6
grid with some gaps (empty cells)
Concept
The table consists of cells which form rows and columns. Each cell contains a single node or might also be empty. Note that it is not required that the input graph already contains a PartitionGrid for this algorithm to properly work. It is, however, useful if the resulting row and column geometry should be retrieved (e.g. to visualize the table). It is mandatory to register a PartitionGrid when using layout policy FIXED_SIZE.
Rows/columns do not overlap and are not compacted: nodes that belong to different rows are strictly separated with respect to the covered y-coordinates range and nodes that belong to different columns are strictly separated with respect to the covered x-coordinate range.
Features
It is possible to define in which cell of the table a certain node should be placed when using policy FIXED_SIZE. See the policy documentation for more details.
The algorithm considers the following properties associated with RowDescriptors and ColumnDescriptors of a PartitionGrid registered with the input graph:
Group nodes are supported but only top-level groups are handled like an actual node in the table. The content of top-level groups is kept fix. That means that the content keeps the relative location with respect to the top-level group but it is not recursively arranged in a tabular fashion. To achieve recursive layouts where the content is a tabular layout too, use RecursiveGroupLayout with TabularLayout as core layout algorithm. Generally, it is recommended that group nodes already have proper bounds enclosing all content (and their labels). Otherwise, overlaps may occur, as group node sizes are not changed by this algorithm. RecursiveGroupLayout with NULL_LAYOUT as core algorithm can be used to recursively assign group node sizes.
Default Values of Properties
considerEdges | false | Edges are not considered. |
considerNodeLabels | true | Node labels are considered. |
defaultNodeLayoutDescriptor | TabularLayoutNodeLayoutDescriptor
| Descriptor instance with default settings. |
layoutPolicy | AUTO_SIZE
| |
maximumDuration | <code>0x7FFFFFFF</code> | The layout algorithm runs unrestricted. |
nodeComparer | null | The nodes are sorted with respect to their indices of the graph structure. |
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.TabularLayout
See Also
Constructors
Initializes a new instance of the TabularLayout class with default settings.
Parameters
A map of options to pass to the method.
- maximumDuration - number
The time limit (in milliseconds) set for the layout algorithm. This option sets the maximumDuration property on the created object.
- considerEdges - boolean
Whether the algorithm should consider edges so that it tries to find a node arrangement with a low overall edge length. This option sets the considerEdges property on the created object.
- defaultNodeLayoutDescriptor - TabularLayoutNodeLayoutDescriptor
The TabularLayoutNodeLayoutDescriptor instance used for all the nodes that do not have an individual layout descriptor. This option sets the defaultNodeLayoutDescriptor property on the created object.
- layoutPolicy - TabularLayoutPolicy
The policy defining the size of the resulting tabular layout and the mapping of the nodes to the table cells. This option sets the layoutPolicy property on the created object.
- considerNodeLabels - boolean
Whether or not the layout algorithm reserves space for node labels. This option sets the considerNodeLabels property on the created object.
- nodeComparer - IComparer<Object>
The IComparer<T> that defines the order in which the free nodes are placed in the table. This option sets the nodeComparer property on the created object.
Properties
Gets or sets whether the algorithm should consider edges so that it tries to find a node arrangement with a low overall edge length.
Remarks
Considering edges means that the algorithm applies a heuristic approach that prefers an arrangement of nodes that lead to a low overall edge length. It is still possible to define the exact table cell for a subset of the nodes, see policy FIXED_SIZE.
This option depend on features of the layout-hierarchic
module, which is not a static dependency of this module for performance reasons. To make sure it's loaded, add the line Class.ensure(HierarchicLayout)
.
Default Value
false
.Edges are not considered.
See Also
Sample Graphs
Gets or sets whether or not the layout algorithm reserves space for node labels.
Remarks
Default Value
true
.Node labels are considered.
See Also
Sample Graphs
Gets or sets the TabularLayoutNodeLayoutDescriptor instance used for all the nodes that do not have an individual layout descriptor.
Gets or sets the policy defining the size of the resulting tabular layout and the mapping of the nodes to the table cells.
Remarks
- AUTO_SIZE: no PartitionGrid instance required. The size of the table is chosen automatically and nodes are sorted using nodeComparer.
- FIXED_SIZE: requires a registered PartitionGrid instance that defines the size of the tabular layout and, optionally, the mapping of nodes to specific cells.
- FROM_SKETCH: no PartitionGrid instance required. The size of the table and the positioning of the nodes is solely derived from the coordinates of the input graph (sketch).
Default Value
AUTO_SIZE.Throws
- Exception({ name: 'ArgumentError' })
- if the given policy is unknown
See Also
Gets or sets the time limit (in milliseconds) set for the layout algorithm.
Remarks
0
.Default Value
<code>0x7FFFFFFF</code>
.The layout algorithm runs unrestricted.
Throws
- Exception({ name: 'ArgumentError' })
- if the maximum duration is negative
Gets or sets the IComparer<T> that defines the order in which the free nodes are placed in the table.
Remarks
The nodes are arranged in the table in a row-wise fashion using the order provided by this IComparer<T>, i.e., the first row is filled from left to right, then the second row is filled, again from left to right etc.
Nodes that are mapped to specific PartitionCellId are considered to be fixed and are not sorted using this IComparer<T>. This only applies when using policy FIXED_SIZE. Furthermore, if FROM_SKETCH is active, this property is ignored.
Default Value
null
.The nodes are sorted with respect to their indices of the graph structure.
See Also
Methods
Arranges the input graph in a tabular fashion.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Implements
Constants
A data provider key for providing layout information for each node.
Domain | YNode | |
Values | TabularLayoutNodeLayoutDescriptor | a node layout descriptor that provides layout information for each node or null if the |