documentationfor yFiles for HTML 3.0.0.3

LayoutGrid

This class represents a layout grid that partitions the drawing area into rectangular layout grid cells.

Inheritance Hierarchy
LayoutGrid

Remarks

Such a structure allows, for example, to model vertical/horizontal swimlanes which are often used in flow diagrams to separate logical units.

The grid consists of rows and columns that are created using the corresponding constructors of this class or methods addRow and addColumn. The LayoutGrid can be defined by using property grid or layoutGridCellDescriptors.

Each node can have a LayoutGridCellDescriptor assigned which represents a set of layout grid cells. The mapping has to be registered with the graph using layoutGridCellDescriptors. Simple layout grid cell descriptors which represent a single layout grid cell, i.e., a row/column pair, can be created using method createCellDescriptor or createCellDescriptor.

Nodes can also be mapped to a layout grid cell descriptor that represents a multi-cell, i.e., a cell spanning multiple columns and rows. Please note, however, that multi-cells are not allowed to overlap each other. This means that the user has to ensure that each grid cell (row/column pair) is associated with at most one cell descriptor. The multi-cell descriptor can be created using methods createCellSpanDescriptor, createCellSpanDescriptor, createCellSpanDescriptor , createColumnSpanDescriptor, and createRowSpanDescriptor.

Sample output of a layout algorithm with a layout grid

Default Values of Properties

Type Details

yFiles module
algorithms
The layout grid cell descriptor of a group node is not inherited by its non-group descendants. Hence, each non-group descendant has to be manually assigned to a layout grid cell descriptor. In addition, a group node mapped to a column/row span layout grid cell descriptor represents the associated column/row. Thus, its boundary corresponds to that of the column/row and edges incident to such a group node are not considered during the layout. Since the boundary of a group node always encompasses all of its children, don't assign a layout grid cell descriptor to layout the group as normal.
Layout grid structures are currently supported by the HierarchicalLayout, OrganicLayout, PartialLayout (depends on the exact setup) and EdgeRouter. The RecursiveGroupLayout allows to define a local layout grid for each recursive group node, so that the grid is supported if the responsible group layout algorithm is one of the aforementioned. Furthermore, layout stage GenericLayoutGridStage offers generic layout grid support.
If at least one node is mapped to a multi-cell, enabling option optimizeColumnOrder or optimizeRowOrder has no effect.
Nodes may be mapped to a layout grid cell descriptor that represents a multi-cell, i.e., a cell spanning multiple rows and columns. However, the user has to ensure that each grid cell (row/column pair) is associated with at most one cell descriptor. More precisely, if a grid cell descriptor represents two cells A and B, no other descriptor must contain cell A or B.

Constructors

Properties

Methods

Constants

Static Methods