An edge label model that allows placement of labels along the edge path at a set of continuous positions at specified sides of the edge path.
Remarks
The set of positions can be influenced by specifying the sideOfEdge value that controls on which side of the edge labels positions should be considered. Furthermore, it's possible to specify distance values that control the distance between label and edge and between label and nodes.
If a label model parameter is created ON_EDGE, the label's center is usually placed on the edge. It can be shifted by specifying a offset value but the distance value is ignored. For all other values of EdgeSides the total distance between the label bounds and the edge path is the sum of offset and distance.
The label placements use a ratio value as fraction of the full edge path length. This is the main difference to the EdgeSegmentLabelModel which uses a specified segment index from the source or target side and a ratio on this segment.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.graph.EdgePathLabelModel
See Also
Constructors
EdgePathLabelModel
(distance?: number, offset?: number, angle?: number, autoRotation?: boolean, sideOfEdge?: EdgeSides)Initializes a new instance of the EdgePathLabelModel class.
Parameters
A map of options to pass to the method.
- distance - number
- the distance to the edge.
- offset - number
- the offset to the default placement.
- angle - number
- the angle of the label's rotation in radians.
- autoRotation - boolean
- if set to
true
auto rotation is enabled. - sideOfEdge - EdgeSides
- the side of the edge labels.
Properties
Gets or sets the distance between the label box and the edge path.
Remarks
The interpretation of the values depends on the sideOfEdge of the individual ILabelModelParameter.
Note that for ON_EDGE this property is ignored. For all other values of EdgeSides the offset property is added to this distance.
See Also
Gets or sets the offset of the label box and the edge path relative to the default placement.
Methods
A model parameter that encodes the default position of this model's allowed edge label positions.
Remarks
Returns
- ↪ILabelModelParameter
- a parameter for this model instance
Implements
Creates a parameter at the provided edge path ratio.
Parameters
A map of options to pass to the method.
- edgePathRatio - number
- The ratio at which to place the label at the edge path. A ratio of 0.0 will place the label at the source side of the edge path, a ratio of 1.0 at the target side. The default is 0.5.
- sideOfEdge - EdgeSides
- The side of the edge the label is placed on. Note that only single enum values but no combined ones are allowed. The default is ON_EDGE.
Returns
- ↪ILabelModelParameter
- A label parameter at the provided edge path ratio for this model instance.
findBestParameter
(label: ILabel, model: ILabelModel, layout: IOrientedRectangle) : ILabelModelParameterTries to find a parameter that best matches the given layout for the provided label instance.
Remarks
null
.Parameters
A map of options to pass to the method.
- label - ILabel
- The label to find a parameter for.
- model - ILabelModel
- The model instance to use. This should be the instance this instance has been obtained from.
- layout - IOrientedRectangle
- The anticipated layout for the label.
Returns
- ↪ILabelModelParameter
- A non-
null
parameter that can be used for the label to approximate the provided layout.
Implements
Returns an empty context.
Parameters
A map of options to pass to the method.
- label - ILabel
- The label to use in the context.
- layoutParameter - ILabelModelParameter
- The parameter to use for the label in the context.
Returns
- ↪ILookup
- An empty context.
See Also
Implements
Calculates the geometry of the given label using the given model parameter.
Parameters
A map of options to pass to the method.
- label - ILabel
- The label to calculate the geometry for.
- layoutParameter - ILabelModelParameter
- A parameter that is compatible with this model. Typically, this is a parameter that has been created by this model, and its property model returns this instance.
Returns
- ↪IOrientedRectangle
- An IOrientedRectangle that describes the geometry of the label. This is typically designed as a flyweight, therefore clients should not cache the instance but store the values if they need a snapshot for later use.
Implements
Returns an enumerator over a set of possible ILabelModelParameter instances that can be used for the given label and model.
Parameters
A map of options to pass to the method.
- label - ILabel
- The label instance to use.
- model - ILabelModel
- The model to provide parameters for.
Returns
- ↪IEnumerable<ILabelModelParameter>
- A possibly empty enumerator over a set of label model parameters.
Implements
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