This layout algorithm places nodes in a tabular fashion.
Remarks
Layout Style
The nodes are placed based on an underlying LayoutGrid 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 LayoutGridCellDescriptors 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 LayoutGrid 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 LayoutGrid 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-coordinate 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 LayoutGridRows and LayoutGridColumns of a LayoutGrid 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 fixed. 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 FIX_CONTENT_LAYOUT as core algorithm can be used to recursively assign group node sizes.
Layout Stages
This class provides a configurable pipeline that contains various ILayoutStages. Each ILayoutStage can incorporate preprocessing or postprocessing steps into the layout calculation to streamline the input graph and enhance the resulting layout. Additionally, custom ILayoutStages can be added and executed either before or after the predefined ones.
The following default ILayoutStages are included:
- GenericLabeling: Efficiently places node and edge labels. The property fillEmptyScope is set to
false
and stopDuration is set to ZERO.
With these layoutStages the layout algorithm is configured well, so they usually don't need to be changed.
Default Values of Properties
considerEdges | false | Edges are not considered. |
defaultNodeDescriptor | TabularLayoutNodeDescriptor
| Descriptor instance with default settings. |
edgeLabelPlacement | GENERIC
| Edge labels are placed by an independent labeling algorithm. |
layoutMode | AUTO_SIZE
| |
nodeLabelPlacement | CONSIDER
| Node labels are considered. |
stopDuration | MAX_VALUE
| The layout algorithm runs unrestricted. |
Type Details
- yFiles module
- algorithms
See Also
Constructors
Initializes a new instance of the TabularLayout class with default settings.
Parameters
A map of options to pass to the method.
- stopDuration - TimeSpan
- The time limit set for the layout algorithm. This option sets the stopDuration 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.
- defaultNodeDescriptor - TabularLayoutNodeDescriptor
- The TabularLayoutNodeDescriptor instance that defines settings for those nodes that do not have an individual descriptor specified. This option either sets the value directly or recursively sets properties to the instance of the defaultNodeDescriptor property on the created object.
- layoutMode - TabularLayoutMode
- The policy defining the size of the resulting tabular layout and the mapping of the nodes to the table cells. This option sets the layoutMode property on the created object.
- nodeLabelPlacement - NodeLabelPlacement
- How the layout handles the position of node labels. This option sets the nodeLabelPlacement property on the created object.
- edgeLabelPlacement - TabularLayoutEdgeLabelPlacement
- How the layout handles the position of edge labels. This option sets the edgeLabelPlacement 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
Default Value
false
.Edges are not considered.
Property Value
true
if edges should be considered, false
otherwiseSee Also
Sample Graphs
Gets or sets the TabularLayoutNodeDescriptor instance that defines settings for those nodes that do not have an individual descriptor specified.
Default Value
Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the specified descriptor is
null
See Also
Gets or sets how the layout handles the position of edge labels.
Default Value
Property Value
Gets the GenericLabeling helper class from the layoutStages of this instance.
Remarks
Throws
- Exception({ name: 'InvalidOperationError' })
- If there is no instance of the respective type in the
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 LayoutGrid instance required. The size of the table is chosen automatically and nodes are sorted using a comparison function specified with property freeNodeComparator.
- FIXED_SIZE: requires a registered LayoutGrid instance that defines the size of the tabular layout and, optionally, the mapping of nodes to specific cells.
- FROM_SKETCH: no LayoutGrid 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.Property Value
Gets the mutable stack of ILayoutStage that will be applied to this layout.
Gets or sets how the layout handles the position of node labels.
Default Value
Property Value
Sample Graphs
Gets or sets the time limit set for the layout algorithm.
Remarks
Default Value
Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the stop duration is negative
Methods
Calculates a tabular layout of the graph.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Implements
Arranges the input graph in a tabular fashion.
createLayoutData
(graph: LayoutGraph) : TabularLayoutData<LayoutNode,LayoutEdge,LayoutNodeLabel,LayoutEdgeLabel>Returns an instance of LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> that can be used to perform item-specific configurations for the TabularLayout.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the graph that determines the generic type arguments of the created layout data
Returns
- ↪TabularLayoutData<LayoutNode,LayoutEdge,LayoutNodeLabel,LayoutEdgeLabel>
- an instance of layout data that can be used to perform item-specific configurations for the given TabularLayout.
Returns an instance of LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> that can be used to perform item-specific configurations for the TabularLayout.
Remarks
Parameters
A map of options to pass to the method.
- graph - IGraph
- the graph that determines the generic type arguments of the created layout data
Returns
- ↪TabularLayoutData<INode,IEdge,ILabel,ILabel>
- an instance of layout data that can be used to perform item-specific configurations for the given TabularLayout.
LayoutExecutor
type is available at runtime.Constants
A data key for publishing the layout grid cell descriptors for all nodes in the graph.
Remarks
A data key for providing layout information for each node.
Remarks
null
if the default descriptor should be used.