- I
- I
- I
Remarks
IGraph, this item supports the lookup method that can be used to query additional aspects of the item.Examples
const graph = graphComponent.graph
const node = graph.createNodeAt(new Point(0, 0))
// add a label to the node
const label = graph.addLabel(
node,
'Some Text',
ExteriorNodeLabelModel.BOTTOM,
)
// the newly created label is part of the graph
console.log(graph.contains(label)) // true
console.log(graph.labels.size) // 1
// the label belongs to its owner
console.log(label.owner === node) // true
console.log(node.labels.size) // 1
console.log(node.labels.get(0) === label) // true
// removing the label removes it from the graph
graph.remove(label)
console.log(graph.contains(label)) // false
console.log(graph.labels.size) // 0
// and from its owner
console.log(node.labels.size) // 0
console.log(label.owner === null) // throws Error!!console.log(graph.contains(label)) // true
graph.remove(label.owner)
console.log(graph.contains(label)) // falseSee Also
The graph model with all relevant types and their relationships is presented in detail in the section The Graph Model.
Using the look-up mechanism is explained in the section Service Locator Pattern: Lookup.
Developer's Guide
Members
Properties
Gets the index of the label at its owner.
Gets a snapshot of the current layout of the label.
<0,-1>), it coincides with its lower left corner. The positioning of the label is determined using a pair of ILabelModel and ILabelModelParameter. In order to modify the layout of a label instance, set another layoutParameter for this label or modify its associated instance.See Also
Developer's Guide
API
- layoutParameter, getGeometry
Gets the label model's parameter that determines the positioning of this label.
Note that the label model parameter instance associated with a label instance may be shared between multiple label instances and that the modification of this instance or its model will result in a change of the positioning of all labels that are associated with the same parameter or model instance.
To change the layout parameter for instances of the default implementation that were created via the factory methods on IGraph, use the setLabelLayoutParameter method.
Examples
graph.setLabelLayoutParameter(label, InteriorNodeLabelModel.CENTER)const parameter = label.layoutParameterconst layout = label.layoutSee Also
Developer's Guide
API
- setLabelLayoutParameter
Implemented in
SimpleLabel.layoutParameterGets the owner of this label.
Throws
- Exception ({ name: 'InvalidOperationError' })
- if the label has no owner.
Examples
// add a label to the owner
const label = graph.addLabel(owner, 'Some Text')
// the label's Owner property is set to the owner
console.log(label.owner === owner) // true
// the label is in its owner's Labels collection
console.log(owner.labels.includes(label)) // trueSee Also
Implemented in
SimpleLabel.ownerGets the preferred size of the label with respect to its current contents and the implementation of the visualization.
Often the layout's size will be the same as the preferred size, but it's up to the implementation of the ILabelModel to interpret it differently.
To change the preferred size for instances of the default implementation that were created via the factory methods on IGraph, use the setLabelPreferredSize method.
Examples
graph.setLabelPreferredSize(label, new Size(width, height))const size = label.preferredSizeSee Also
Developer's Guide
API
- setLabelPreferredSize, adjustLabelPreferredSize, calculateLabelPreferredSize
Implemented in
SimpleLabel.preferredSizeGets the style that is responsible for the visual representation of this node in a CanvasComponent.
Note that the style instance associated with a label instance may be shared between multiple label instances and that the modification of this style will result in a change of the appearance of all labels that are associated with the same style instance.
To change the style for instances of the default implementation that were created via the factory methods on IGraph, use the setStyle method.
Examples
graph.setStyle(label, new LabelStyle())const style = label.styleSee Also
Developer's Guide
API
- setStyle
Implemented in
SimpleLabel.styleProperty Value
Examples
owner.tag = newTagconst tag = owner.tagSee Also
- Tags are presented in detail in the section The Graph Model.
Developer's Guide
Defined in
ITagOwner.tagIt is up to the visualization engine to interpret this property for the visualization of the label. Normally, it will render the text into the layout of this instance.
To change the text for instances of the default implementation that were created via the factory methods on IGraph, use the setLabelText method.
Examples
graph.setLabelText(label, 'Some Text')const text = label.textSee Also
Developer's Guide
API
- setLabelText
Implemented in
SimpleLabel.textMethods
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 re-obtained for further use.Parameters
- type: Constructor<T>
- the type for which an instance shall be returned
Return Value
- T
- an instance that is assignable to the type or
null
See Also
Developer's Guide