This class represents a partition grid that partitions the drawing area into rectangular partition cells.
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 PartitionGrid object has to be registered with the graph using the IDataProvider key PARTITION_GRID_DP_KEY.
Each node can be assigned to a PartitionCellId which represents a set of partition cells. The mapping has to be registered with the graph using IDataProvider key PARTITION_CELL_ID_DP_KEY. Simple partition cell identifiers which represent a single partition cell, i.e., a row/column pair, can be created using method createCellId or createCellId.
Nodes can also be mapped to a partition cell identifier 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 partition cell (row/column pair) is associated with at most one partition cell identifier. The multi-cell identifier can be created using methods createCellSpanId, createCellSpanId, createCellSpanId, createColumnSpanId, and createRowSpanId.
Default Values of Properties
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.PartitionGrid
See Also
Constructors
PartitionGrid
(rowCount?: number, columnCount?: number, rowInsets?: number, columnInsets?: number, minRowSize?: number, minColumnSize?: number)Creates an instance of PartitionGrid with the given number of rows and columns as well as with given insets and minimum sizes.
Parameters
A map of options to pass to the method.
- rowCount - number
- the number of rows
- columnCount - number
- the number of columns
- rowInsets - number
- the top and bottom insets of the rows
- columnInsets - number
- the left and right insets of the columns
- minRowSize - number
- the minimum row height
- minColumnSize - number
- the minimum column width
- optimizeColumnOrder - boolean
Whether or not the order of the columns should be chosen automatically to minimize edge lengths. This option sets the optimizeColumnOrder property on the created object.
- optimizeRowOrder - boolean
Whether or not the order of the rows should be chosen automatically to minimize edge lengths. This option sets the optimizeRowOrder property on the created object.
Properties
Gets the columns of the partition grid.
Gets or sets whether or not the order of the columns should be chosen automatically to minimize edge lengths.
Remarks
true
, the relative ordering given by the indices is preserved. The remaining columns may be sorted again so that the overall edge lengths are minimized.Default Value
true
.See Also
Sample Graphs
Gets or sets whether or not the order of the rows should be chosen automatically to minimize edge lengths.
Remarks
true
, the relative ordering given by the indices is preserved. The remaining rows may be sorted again so that the overall edge lengths are minimized.Default Value
true
.See Also
Sample Graphs
Gets the rows of the partition grid.
Methods
Adds a new column to the PartitionGrid instance.
Remarks
Returns
- ↪ColumnDescriptor
- a new ColumnDescriptor instance
Adds a new row to the PartitionGrid instance.
Creates a partition cell identifier that represents the cell defined by the given column and row.
Parameters
A map of options to pass to the method.
- rd - RowDescriptor
- the row defining the cell
- cd - ColumnDescriptor
- the column defining the cell
Returns
- ↪PartitionCellId
- a PartitionCellId instance
Throws
- Exception({ name: 'ArgumentError' })
- if the given column/row is
null
Creates a partition cell identifier that represents the cell defined by the given column and row index.
Parameters
A map of options to pass to the method.
- rowIndex - number
- the row index of the row defining the cell
- columnIndex - number
- the column index of the column defining the cell
Returns
- ↪PartitionCellId
- a PartitionCellId instance
Throws
- Exception({ name: 'ArgumentError' })
- if the given column/row index is not valid
See Also
createCellSpanId
(fromRowIndex: number, fromColIndex: number, toRowIndex: number, toColIndex: number) : PartitionCellIdCreates a partition cell identifier that represents a multi-cell spanning multiple columns and rows.
Remarks
The partition cell identifier represents all cells defined by a row with index between fromRowIndex
and toRowIndex
(both including) and a column with index between fromColIndex
and toColIndex
(both including).
A group node mapped to such a partition cell identifier represents the multi-cell, i.e., its boundary corresponds to the smallest rectangle containing all partition cells specified by the partition cell identifier. The boundary does not depend on the partition cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the partition cells. Furthermore, edges incident to such a group node are not considered during the layout.
Parameters
A map of options to pass to the method.
- fromRowIndex - number
- the row index of the topmost row defining the cell
- fromColIndex - number
- the column index of the leftmost column defining the cell
- toRowIndex - number
- the row index of the bottommost row defining the cell
- toColIndex - number
- the column index of the rightmost column defining the cell
Returns
- ↪PartitionCellId
- a PartitionCellId instance
See Also
Creates a partition cell identifier that represents a multi-cell spanning multiple columns and rows.
Remarks
The partition cell identifier represents all cells spanned by the columns of columnList
and rows of rowList
.
A group node mapped to such a partition cell identifier represents the multi-cell, i.e., its boundary corresponds to the smallest rectangle containing all partition cells specified by the partition cell identifier. The boundary does not depend on the partition cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the partition cells. Furthermore, edges incident to such a group node are not considered during the layout.
Parameters
A map of options to pass to the method.
- rowList - ICollection<Object>
- the rows defining the cell
- columnList - ICollection<Object>
- the columns defining the cell
Returns
- ↪PartitionCellId
- a PartitionCellId instance
createCellSpanId
(fromRow: RowDescriptor, fromCol: ColumnDescriptor, toRow: RowDescriptor, toCol: ColumnDescriptor) : PartitionCellIdCreates a partition cell identifier that represents a multi-cell spanning multiple columns and rows.
Remarks
The partition cell identifier represents all cells defined by a row between fromRow
and toRow
(both including) and a column between fromRow
and toCol
(both including).
A group node mapped to such a partition cell identifier represents the multi-cell, i.e., its boundary corresponds to the smallest rectangle containing all partition cells specified by the partition cell identifier. The boundary does not depend on the partition cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the partition cells. Furthermore, edges incident to such a group node are not considered during the layout.
Parameters
A map of options to pass to the method.
- fromRow - RowDescriptor
- the topmost row defining the cell
- fromCol - ColumnDescriptor
- the leftmost column defining the cell
- toRow - RowDescriptor
- the bottommost row defining the cell
- toCol - ColumnDescriptor
- the rightmost column defining the cell
Returns
- ↪PartitionCellId
- a PartitionCellId instance
Creates a partition cell identifier that represents a cell spanning a whole column.
Remarks
Parameters
A map of options to pass to the method.
- columnIndex - number
- the column index of the column defining the cell
Returns
- ↪PartitionCellId
- a PartitionCellId instance
Creates a partition cell identifier that represents a cell spanning a whole row.
Remarks
Parameters
A map of options to pass to the method.
- rowIndex - number
- the row index of the row defining the cell
Returns
- ↪PartitionCellId
- a PartitionCellId instance
Finalizes the orientation changes and is called at the end of the OrientationLayout stage.
Remarks
Parameters
A map of options to pass to the method.
- orientationLayouter - OrientationLayout
- an OrientationLayout instance
See Also
Returns the column with the given index.
Parameters
A map of options to pass to the method.
- index - number
- the index of the column to be returned
Returns
- ↪ColumnDescriptor
- the column with the given index or
null
if no such column exists
Returns the row with the given index.
Parameters
A map of options to pass to the method.
- index - number
- the index of the row to be returned
Returns
- ↪RowDescriptor
- the row with the given index or
null
if no such row exists
Prepares for the orientation changes and is called at the beginning of the OrientationLayout stage.
Remarks
Parameters
A map of options to pass to the method.
- orientationLayouter - OrientationLayout
- an OrientationLayout instance
See Also
Constants
A data provider key for storing a set of partition cells for each node.
Remarks
Domain | YNode | |
Values | PartitionCellId | a null if no such set is specified |
See Also
A data provider key for storing the partition grid structure.
Remarks
Domain | Graph | the input graph |
Values | PartitionGrid | the |
See Also
Static Methods
Returns the PartitionGrid instance associated with the given graph.
Parameters
A map of options to pass to the method.
- graph - Graph
- the given graph
Returns
- ↪PartitionGrid
- the PartitionGrid of the graph or
null
if the graph has no associated partition grid