Members
Constructors
Properties
The nodes are arranged in the table in a row-wise fashion using the order provided by this comparison, 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 LayoutGridCellDescriptor are considered to be fixed and are not sorted using this function. This only applies when using policy FIXED_SIZE. Furthermore, if FROM_SKETCH is active, this property is ignored.
Property Value
null if the order should be defined by the internal node indicesDefault Value
See Also
Developer's Guide
Gets a mapper from nodes to their assigned layout grid cell descriptors.
Examples
const tabularLayout = new TabularLayout()
const layoutData = new TabularLayoutData()
graph.applyLayout(tabularLayout, layoutData)
for (const node of graph.nodes) {
const descriptor = layoutData.layoutGridCellDescriptorsResult.get(node)!
console.log(
`Node ${node} has been placed in row ${descriptor.row.index}, column ${descriptor.column.index}`,
)
}See Also
Gets or sets the layout grid data.
- When using AUTO_SIZE, it is not necessary to define a layout grid at all. If a grid is specified, its existing rows and columns will be cleared and the grid is filled with the data resembling the computed layout. That allows to query information about the rows and columns using classes LayoutGridRow and LayoutGridColumn (e.g. query computed position of row/column).
- For policy FIXED_SIZE, it is necessary to define a layout grid instance. The size of the given grid defines the size of the computed tabular layout. A node can be mapped to a specific grid cell to manually define its location in the layout.
- Policy FROM_SKETCH: the same as for AUTO_SIZE applies with respect to the necessity of the layout grid. That means that the grid is optional and only necessary if the resulting dimension shall be queried after the layout.
See Also
Developer's Guide
Gets or sets the mapping of nodes to their TabularLayoutNodeDescriptor that defines custom node placement settings.
null, then the default descriptor applies for that node.See Also
Developer's Guide
API
- NODE_DESCRIPTOR_DATA_KEY
Gets or sets the mapping from nodes to their margins.
Examples
The easiest option is to reserve the same space around all nodes, by setting a constant value:
layoutData.nodeMargins = new Insets(20)Handling only certain nodes differently can be done easily by using the mapper property:
// node1 only reserves space above and below
layoutData.nodeMargins.mapper.set(node1, new Insets(20, 10, 0, 0))
// node2 has space all around
layoutData.nodeMargins.mapper.set(node2, new Insets(25))
// all other nodes don't get extra spaceIn cases where the nodeMargins for each node can be determined by looking at the node itself it's often easier to just set a mapperFunction instead of preparing a mapper:
// Retrieve the space around the node from its tag property
layoutData.nodeMargins = (node: INode): Insets =>
new Insets(parseFloat(node.tag))See Also
Methods
combineWith
(data: LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>): LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>Combines this instance with the given layout data.
combineWith
(data: LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>): LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>Parameters
- data: LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>
- The LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> to combine this instance with.
Return Value
- LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>
- The combined layout data.
See Also
Developer's Guide
API
- CompositeLayoutData, GenericLayoutData