Central interface which provides support for tabular data presentation.
Remarks
This interface supports a presentation of data where the nodes of a diagram are organized in a tabular way, i.e., where each node is associated to a specific row and column in the grid-like structure of a table. The ITable together with its associated interfaces IColumn and IRow represents the model for the tabular presentation (or table, for short). It also provides means for altering the model, in particular creation (createChildColumn and createChildRow) and removal of columns and rows but also changing their size or appearance.
The table structure is backed by a group node. As a consequence, the nodes which should be presented in a tabular fashion need to be set up as children of this group node. Using a group node to hold the content nodes has several advantages: For example, when the group node is moved, the child nodes move accordingly, thus maintaining the visual clue that they are contained in the table group node.
Note that the table structure and its content nodes are only loosely coupled: the node's center coordinates determine the row and column that it belongs to.
Associating an ITable instance with its backing group node can most conveniently be done by setting a TableNodeStyle instance as style of the associated group node. This style manages the visualization of the individual rows and columns. It also associates its table with the group node by decorating its lookup to return the table instance.
User interaction is supported by the TableEditorInputMode which provides support for interactively resizing rows and columns, re-parenting them, or editing their labels.
Related Reading in the Developer's Guide
Type Details
- yfiles module
- view-table
- yfiles-umd modules
- view-table, view
- Legacy UMD name
- yfiles.graph.ITable
See Also
Properties
Return the accumulated insets for the table.
Gets or sets the defaults for Columns.
Remarks
See Also
Gets a TableDecorator instance for use with this table.
Gets or sets the insets for this table.
Remarks
See Also
Gets the layout of the table, relative to an owner node.
Gets the virtual root of the column hierarchy
Remarks
See Also
Gets the virtual root of the row hierarchy
Remarks
See Also
Gets or sets the defaults for rows.
Remarks
See Also
Methods
addLabel
(owner: IStripe, text: string, layoutParameter?: ILabelModelParameter, style?: ILabelStyle, preferredSize?: Size, tag?: Object) : ILabelAdd a label to the given owner using the text as the initial label text and label model parameter and style.
Parameters
A map of options to pass to the method.
- owner - IStripe
- the owner to add the label to.
- text - string
- the initial text of the label
- layoutParameter - ILabelModelParameter
- The label model parameter instance to use.
- style - ILabelStyle
- The style to use for the label
- preferredSize - Size
- The initial values to use for the preferredSize.
- tag - Object
- the initial tag to assign.
Returns
- ↪ILabel
- the newly created label
See Also
Adjusts the preferredSize property of a label to fit the suggested size of its ILabelStyleRenderer.
calculateLabelPreferredSize
(stripe: IStripe, style: ILabelStyle, layoutParameter: ILabelModelParameter, text: string, tag: Object) : SizeCalculates the preferred size of a label with the given properties.
Parameters
A map of options to pass to the method.
- stripe - IStripe
- The item that will own the label.
- style - ILabelStyle
- The label style.
- layoutParameter - ILabelModelParameter
- The label model parameter.
- text - string
- The text.
- tag - Object
- The tag for the label.
Returns
- ↪Size
- The size as calculated by the ILabelStyleRenderer.
createChildColumn
(owner: IColumn, width?: number, minWidth?: number, insets?: Insets, style?: IStripeStyle, tag?: Object, index?: number) : IColumnCreate a new column as the index
th child of owner
with the given parameters.
Parameters
A map of options to pass to the method.
- owner - IColumn
- The owner of the new column.
- width - number
- The actual width of the column.
- minWidth - number
- The minimal width of the column.
- insets - Insets
- The insets of the column.
- style - IStripeStyle
- The style of the column.
- tag - Object
- The tag of the column
- index - number
- The position in the child list.
- labels - string[]
- An array of labels to add to the newly created node. Each item will be passed to the addLabel method.
- childColumns - number[]
- An array of rows to create as children of this row. Each item will be passed to the createChildColumn method.
Returns
- ↪IColumn
- A new column instance
See Also
createChildRow
(owner: IRow, height?: number, minHeight?: number, insets?: Insets, style?: IStripeStyle, tag?: Object, index?: number) : IRowCreate a new row as the index
th child of owner
with the given parameters.
Parameters
A map of options to pass to the method.
- owner - IRow
- The owner of the new row.
- height - number
- The actual height of the row.
- minHeight - number
- The minimal height of the row.
- insets - Insets
- The insets of the row.
- style - IStripeStyle
- The style of the row.
- tag - Object
- The tag of the row
- index - number
- The position in the child list.
- labels - string[]
- An array of labels to add to the newly created node. Each item will be passed to the addLabel method.
- childRows - number[]
- An array of rows to create as children of this row. Each item will be passed to the createChildRow method.
Returns
- ↪IRow
- A new row instance
See Also
createColumn
(width?: number, minWidth?: number, insets?: Insets, style?: IStripeStyle, tag?: Object, index?: number) : IColumnCreates and returns a column as last child of table
.
Remarks
Parameters
A map of options to pass to the method.
- width - number
- The actual width of the column.
- minWidth - number
- The minimal width of the column.
- insets - Insets
- The insets of the column.
- style - IStripeStyle
- The style of the column.
- tag - Object
- The tag of the column
- index - number
- The position in the child list.
Returns
- ↪IColumn
- A newly created column instance
See Also
Creates the label model parameter for a given ILabelOwner.
Remarks
table
to obtain the parameter instance.Parameters
A map of options to pass to the method.
Returns
- ↪ILabelModelParameter
- The default label model parameter to use for newly created labels at the item.
See Also
Creates an instance of the default label style for the given stripe
.
Remarks
Parameters
A map of options to pass to the method.
- stripe - IStripe
- The item the newly created label will belong to.
Returns
- ↪ILabelStyle
- The style instance to use for newly created stripes.
createRow
(height?: number, minHeight?: number, insets?: Insets, style?: IStripeStyle, tag?: Object, index?: number) : IRowCreates and returns a row as last child of table
.
Remarks
Parameters
A map of options to pass to the method.
- height - number
- The actual height of the row.
- minHeight - number
- The minimal height of the row.
- insets - Insets
- The insets of the row.
- style - IStripeStyle
- The style of the row.
- tag - Object
- The tag of the row
- index - number
- The position in the child list.
Returns
- ↪IRow
- A newly created row instance
See Also
Finds a column underneath a certain point.
Remarks
Parameters
A map of options to pass to the method.
- node - INode
- The node this table is currently bound to
- location - Point
- The location to test.
- filter - function(IStripe):boolean
- Additional predicate to further restrict the results.
Signature Details
function(obj: IStripe) : boolean
Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters
- obj - IStripe
- The object to compare against the criteria defined within the method represented by this delegate.
Returns
- boolean
true
if obj meets the criteria defined within the method represented by this delegate; otherwise,false
.
Returns
- ↪IColumn
- The topmost column that has been found for the location or
null
.
Finds a row underneath a certain point.
Remarks
Parameters
A map of options to pass to the method.
- node - INode
- The node this table is currently bound to
- location - Point
- The location to test.
- filter - function(IStripe):boolean
- Additional predicate to further restrict the results.
Signature Details
function(obj: IStripe) : boolean
Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters
- obj - IStripe
- The object to compare against the criteria defined within the method represented by this delegate.
Returns
- boolean
true
if obj meets the criteria defined within the method represented by this delegate; otherwise,false
.
Returns
- ↪IRow
- The topmost row that has been found for the location or
null
.
findStripes
(node: INode, location: Point, stripeTypes: StripeTypes, filter?: function(IStripe):boolean) : IEnumerable<IStripe>Finds all stripes underneath a certain point.
Remarks
Parameters
A map of options to pass to the method.
- node - INode
- The node this table is currently bound to
- location - Point
- The location to test.
- stripeTypes - StripeTypes
- An enumeration value of StripeTypes to specify the stripe type.
- filter - function(IStripe):boolean
- Additional predicate to further restrict the hit test results.
Signature Details
function(obj: IStripe) : boolean
Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters
- obj - IStripe
- The object to compare against the criteria defined within the method represented by this delegate.
Returns
- boolean
true
if obj meets the criteria defined within the method represented by this delegate; otherwise,false
.
Returns
- ↪IEnumerable<IStripe>
- The stripes that have been found for the location or
null
.
See Also
Calculates the relative bounds of a table cell that is determined by column
and row
Remarks
column
and row
must live in the provided table
instance. Otherwise, an ArgumentError is thrown.Parameters
A map of options to pass to the method.
Returns
- ↪Rect
- The relative bounds of a the cell determined by
column
androw
Throws
- Exception({ name: 'ArgumentError' })
- If
column
androw
are part of a different table instance.
Returns an instance that implements the given type or null
.
Remarks
null
implementations for the types, nor does it have to return the same instance any time. Also it depends on the type and context whether the instance returned stays up to date or needs to be reobtained for subsequent use.Type Parameters
- T: any
Parameters
A map of options to pass to the method.
- type - Class<T>
- The type for which an instance shall be returned.
Returns
- ↪T
- an instance that is assignable to type or
null
See Also
$class
property on JavaScript classes inheriting from yFiles classes is only valid once an instance of this subclass was created. Call fixType, first or instantiate the class at least once.Defined in
Removes stripe
from its parent container.
Remarks
stripe
to the parent of the stripe.Parameters
A map of options to pass to the method.
- stripe - IStripe
- The stripe to remove
See Also
Removes stripe
and all of its descendants from table
.
Remarks
Parameters
A map of options to pass to the method.
- stripe - IStripe
- The stripe to remove
See Also
Sets the label model parameter for the given label.
Parameters
A map of options to pass to the method.
- label - ILabel
- The label.
- layoutParameter - ILabelModelParameter
- The new parameter.
Throws
- Exception({ name: 'ArgumentError' })
- If the parameter cannot be used for this label.
Sets the preferred size of the label.
Parameters
A map of options to pass to the method.
See Also
Sets the label text of the given label.
Parameters
A map of options to pass to the method.
- label - ILabel
- the label to modify
- text - string
- the new text of the label
See Also
Sets the minimum size of stripe
.
Remarks
stripe
.Parameters
A map of options to pass to the method.
- stripe - IStripe
- The stripe to change
- minimumSize - number
- The new minimum size of the stripe
Sets the insets of stripe
.
Parameters
A map of options to pass to the method.
See Also
Assigns the given style instance by reference to the label.
Remarks
Parameters
A map of options to pass to the method.
- label - ILabel
- The label that will be assigned the new style
- style - ILabelStyle
- The style instance that will be assigned to the label.
See Also
Sets the style of stripe
.
Parameters
A map of options to pass to the method.
- stripe - IStripe
- The stripe to change
- style - IStripeStyle
- The new style of the stripe
See Also
Events
Occurs when a label has been added to this graph instance.
See Also
Event Registration
addLabelAddedListener(function(this, ItemEventArgs<ILabel>):void)
Event Deregistration
removeLabelAddedListener(function(this, ItemEventArgs<ILabel>):void)
Signature Details
function(sender: this, evt: ItemEventArgs<ILabel>)
Parameters
- sender - this
- The source of the event.
- evt - ItemEventArgs<ILabel>
- An object that contains the event data.
Occurs when a label has been changed, for instance, if its style has been replaced.
See Also
Event Registration
addLabelChangedListener(function(this, ItemEventArgs<ILabel>):void)
Event Deregistration
removeLabelChangedListener(function(this, ItemEventArgs<ILabel>):void)
Signature Details
function(sender: this, evt: ItemEventArgs<ILabel>)
Parameters
- sender - this
- The source of the event.
- evt - ItemEventArgs<ILabel>
- An object that contains the event data.
Occurs when a label has been removed from this graph instance.
Remarks
This event will also be triggered, prior to the removal of the owner of the label.
Implementations may choose to use the LabelEventArgs to carry additional label owner information. The owner property will be set to the owner of the label that owned it before the removal.
See Also
Event Registration
addLabelRemovedListener(function(this, LabelEventArgs):void)
Event Deregistration
removeLabelRemovedListener(function(this, LabelEventArgs):void)
Signature Details
function(sender: this, evt: LabelEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - LabelEventArgs
- An object that contains the event data.
Occurs when a stripe has been changed, for instance, if its style has been replaced.
See Also
Event Registration
addStripeChangedListener(function(this, StripeEventArgs):void)
Event Deregistration
removeStripeChangedListener(function(this, StripeEventArgs):void)
Signature Details
function(sender: this, evt: StripeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - StripeEventArgs
- An object that contains the event data.
Occurs when a stripe has been added.
See Also
Event Registration
addStripeCreatedListener(function(this, ItemEventArgs<IStripe>):void)
Event Deregistration
removeStripeCreatedListener(function(this, ItemEventArgs<IStripe>):void)
Signature Details
function(sender: this, evt: ItemEventArgs<IStripe>)
Parameters
- sender - this
- The source of the event.
- evt - ItemEventArgs<IStripe>
- An object that contains the event data.
Occurs when a stripe has been removed from its parent.
See Also
Event Registration
addStripeRemovedListener(function(this, StripeEventArgs):void)
Event Deregistration
removeStripeRemovedListener(function(this, StripeEventArgs):void)
Signature Details
function(sender: this, evt: StripeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - StripeEventArgs
- An object that contains the event data.
Static Methods
findStripe
(location: Point, stripeTypes: StripeTypes, subregionTypes: StripeSubregionTypes, canvas: CanvasComponent, filter?: function(StripeSubregion):boolean) : StripeSubregionFinds a stripe underneath a certain point.
Parameters
A map of options to pass to the method.
- location - Point
- The location to test.
- stripeTypes - StripeTypes
- An enumeration value of StripeTypes to specify the stripe type.
- subregionTypes - StripeSubregionTypes
- An enumeration value of StripeSubregionTypes to further restrict the stripe region.
- canvas - CanvasComponent
- The canvas that provides necessary context for hit determination, such as hitTestRadius.
- filter - function(StripeSubregion):boolean
- Additional predicate to further restrict the hit test results.
Signature Details
function(obj: StripeSubregion) : boolean
Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters
- obj - StripeSubregion
- The object to compare against the criteria defined within the method represented by this delegate.
Returns
- boolean
true
if obj meets the criteria defined within the method represented by this delegate; otherwise,false
.
Returns
- ↪StripeSubregion
- The stripe subregions that have been found for the location or
null
.
See Also
findStripes
(location: Point, stripeTypes: StripeTypes, subregionTypes: StripeSubregionTypes, canvas: CanvasComponent, filter?: function(StripeSubregion):boolean) : IEnumerable<StripeSubregion>Used as a callback to find the items underneath a certain point.
Parameters
A map of options to pass to the method.
- location - Point
- The location to test.
- stripeTypes - StripeTypes
- An enumeration value of StripeTypes to specify the stripe type.
- subregionTypes - StripeSubregionTypes
- An enumeration value of StripeSubregionTypes to further restrict the stripe region.
- canvas - CanvasComponent
- The canvas that provides necessary context for hit determination, such as hitTestRadius.
- filter - function(StripeSubregion):boolean
- Additional predicate to further restrict the hit test results.
Signature Details
function(obj: StripeSubregion) : boolean
Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.Parameters
- obj - StripeSubregion
- The object to compare against the criteria defined within the method represented by this delegate.
Returns
- boolean
true
if obj meets the criteria defined within the method represented by this delegate; otherwise,false
.
Returns
- ↪IEnumerable<StripeSubregion>
- The stripe subregions that have been found for the location.
Calculates the absolute bounds of a table cell that is determined by column
and row
Remarks
column
and row
must live in the same ITable instance that is also present in the tableNode
s ILookup. Otherwise, an ArgumentError is thrown.Parameters
A map of options to pass to the method.
- tableNode - INode
- The node where a table is bound to via the node's lookup
- column - IColumn
- The column that determines the cell
- row - IRow
- The row that determines the cell
Returns
- ↪Rect
- The absolute bounds of a the cell determined by
column
androw
Throws
placeNodeInCell
(graph: IGraph, node: INode, tableNode: INode, column: IColumn, row: IRow, reparent?: boolean, alwaysMove?: boolean)Places node
in the center of the table cell determined by column
and row
.
Remarks
Both column
and row
must live in the same ITable instance that is also present in the tableNode
s ILookup. Otherwise, an ArgumentError is thrown. The cell bounds are determined by getCellBounds.
If reparent
is true
, the node is made a child node of tableNode
if it is no descendant of the table node hierarchy yet. Otherwise, the grouping hierarchy is not changed.
If alwaysMove
is true
, the node is moved even if its center is already contained in the cell, otherwise only when the node layout center is currently outside of the cell bounds.
This method does not change the size of the target stripes if they would be too small to contain the whole node layout. Callers must increase the stripe size before or after calling this method, if necessary.
Parameters
A map of options to pass to the method.
- graph - IGraph
- The graph instance where the move should be performed
- node - INode
- The node that should be moved into the given cell.
- tableNode - INode
- The node where a table is bound to via the node's lookup
- column - IColumn
- The column that determines the cell
- row - IRow
- The row that determines the cell
- reparent - boolean
- Whether
node
should also be made part oftableNode
's grouping hierarchy if it is not yet contained in it. - alwaysMove - boolean
- Whether
node
should be moved even if it is already placed in the cell.