SliderEdgeLabelLayoutModel allows placement of labels at a set of continuous rotated positions along both sides of an edge or directly on the edge path.
Remarks
It is possible to specify distance values that control the distance between label and edge and between label and nodes.
CENTER mode on the left, SIDE mode in the middle and SINGLE_SIDE on the right
Default Values of Properties
angle | 0 | |
autoFlipping | false | Edge labels keep their orientation. |
autoRotation | true | Labels are rotated with their edge segment. |
distance | 5 | |
distanceRelativeToEdge | true | The distance to the edge is interpreted relative to the edge's path. |
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.SliderEdgeLabelLayoutModel
See Also
Constructors
Creates a new instance of SliderEdgeLabelLayoutModel with the given mode.
Parameters
A map of options to pass to the method.
- mode - SliderMode
- the slider mode
See Also
Properties
Gets a model parameter that encodes the default position of this model's allowed edge label positions.
Remarks
This parameter can be passed to getLabelPlacement to retrieve the corresponding label box.
The default positions for the slider modes are relative to the first edge segment, either at the beginning of the segment (SIDE or SINGLE_SIDE) or at its middle (CENTER).
See Also
Implements
Gets or sets the distance between the label's box and the edge's path.
Default Value
5
.See Also
Sample Graphs
Gets or sets whether or not the distance to the edge is interpreted relative to the edge's path.
Remarks
If enabled, the label is placed to the left of the edge segment (relative to the segment direction) if the given distance is less than 0
and to the right of the edge segment if the given distance is greater than 0
.
If disabled, the label is placed below the edge segment (in geometric sense) if the distance is less than 0
and above the edge segment if the distance is greater than 0
.
Default Value
true
.The distance to the edge is interpreted relative to the edge's path.
See Also
Gets the model's slider mode which determines whether the label slides on the edge, along both sides of the edge or along one side of the edge.
Methods
createModelParameter
(labelBounds: YOrientedRectangle, edgeLayout: IEdgeLayout, sourceNode: INodeLayout, targetNode: INodeLayout) : ObjectCreates a model parameter that represents the given edge label position within this model.
Remarks
The created model parameter is the closest parameter representation of the given label location that can be achieved within this model.
This parameter can be passed to getLabelPlacement to retrieve the current label box.
A model parameter can be an arbitrary Object. However it must contain all information to allow restoring of the encoded location with this IEdgeLabelLayoutModel.
Parameters
A map of options to pass to the method.
- labelBounds - YOrientedRectangle
- the oriented box of the label, encoding the label location for which the parameter should be created
- edgeLayout - IEdgeLayout
- the layout of the edge to which the label belongs
- sourceNode - INodeLayout
- the layout of the source node of the label-owning edge
- targetNode - INodeLayout
- the layout of the target node of the label-owning edge
Returns
- ↪Object
- the model parameter representing the given label location
See Also
Implements
getLabelCandidates
(labelLayout: IEdgeLabelLayout, edgeLayout: IEdgeLayout, sourceLayout: INodeLayout, targetLayout: INodeLayout) : YListReturns all EdgeLabelCandidates that describe valid label positions within this model.
Remarks
Parameters
A map of options to pass to the method.
- labelLayout - IEdgeLabelLayout
- the label for which candidates should be generated
- edgeLayout - IEdgeLayout
- the layout of the edge to which the label belongs
- sourceLayout - INodeLayout
- the layout of the source node of the label-owning edge
- targetLayout - INodeLayout
- the layout of the target node of the label-owning edge
Returns
- ↪YList
- a list of EdgeLabelCandidate instances
Implements
getLabelPlacement
(labelSize: YDimension, edgeLayout: IEdgeLayout, sourceNode: INodeLayout, targetNode: INodeLayout, para: Object) : YOrientedRectangleReturns the oriented box of the label for the position encoded by the given model parameter.
Parameters
A map of options to pass to the method.
- labelSize - YDimension
- the width and height of the label
- edgeLayout - IEdgeLayout
- the layout of the edge to which the label belongs
- sourceNode - INodeLayout
- the layout of the source node of the label-owning edge
- targetNode - INodeLayout
- the layout of the target node of the label-owning edge
- para - Object
- the model parameter that describes the abstract position of the label within this model
Returns
- ↪YOrientedRectangle
- the oriented bounds of the label