Labels
A label adds information to a graph element by providing a caption. It is modeled by interface ILabel. It belongs to a label owner, modeled by the ILabelOwner interface. The three interfaces INode, IEdge, and IPort extend this interface. In this manual, labels at nodes, edges, and ports are sometimes referred to as node labels, edge labels, and port labels. A label owner can have multiple labels.
Interface ILabel exposes the following read-only properties, which can be modified by IGraph’s methods:
Property | Setter Method | Description |
---|---|---|
The following image shows labels at nodes and edges with different styles and location model parameters. Edge labels can be axis-aligned or rotated with the edge, depending on their label model. See the section about label models.

Even though labels are kept in their owner’s labels collection, you can only add or remove them by using IGraph’s methods.
- addLabel(owner: ILabelOwner, text: string, layoutParameter: ILabelModelParameter, style: ILabelStyle, preferredSize: Size, tag: Object): ILabel
- Creates a new label for the given owner. The new label’s properties will get the default values as defined in the label defaults if they are not passed as parameters.
- remove(item: IModelItem): void
- Removes the given label from the graph.
You can only modify or remove labels that are part of the current graph instance. Trying to modify or remove a label that already has been removed will result in an exception. Also, if your use case involves several IGraph instances (especially if you are using filtering or folding) be careful to modify and remove labels only with the graph the label belongs to.