NodeLabelCandidates provides candidates for LayoutNodeLabels.
Remarks
The created candidates are used by the GenericLabeling algorithm and specify valid candidate positions for the label placement.
Different candidates can be assigned a weight value when adding them, which is propagated to the created candidate's custom weight property and is used to prioritize the candidates.
Type Details
- yFiles module
- algorithms
Constructors
Creates a new, empty NodeLabelCandidates instance.
Methods
addDiscreteCandidates
(labelPositions: DiscreteNodeLabelPositions, distance?: number, weight?: number) : NodeLabelCandidatesAdds a set of candidates that describe label placements at eight positions around a node and nine positions inside the node.
Parameters
A map of options to pass to the method.
- labelPositions - DiscreteNodeLabelPositions
- The label positions specify the valid positions for the candidates
- distance - number
- The distance between the label candidate's bounds and the node. The distance must be a non-negative value. For positions in the node's interior, the distance specifies a padding from the node's boundary. The default is
40.0
. - weight - number
- The weight for the candidates. The weight value can be used to specify priorities between different candidates. The default is
1.0
.
Returns
- ↪NodeLabelCandidates
- The calling instance of NodeLabelCandidates
Adds a candidate that describes a label placement at a single fixed position.
Parameters
A map of options to pass to the method.
- box - IOrientedRectangle
- the bounds of the generated node label candidate
- weight - number
- the weight for the created candidate. The weight value can be used to specify priorities between different candidates. The default is
1.0
.
Returns
- ↪NodeLabelCandidates
- the calling instance of NodeLabelCandidates
Adds a set of candidates that describe label placements freely chosen from the area near the label's node.
Parameters
A map of options to pass to the method.
- weight - number
- the weight for the candidates. The weight value can be used to specify priorities between different candidates. The default is
1.0
.
Returns
- ↪NodeLabelCandidates
- the calling instance of NodeLabelCandidates
Returns all LabelCandidates that describe valid label positions.
Remarks
Parameters
A map of options to pass to the method.
- label - LayoutNodeLabel
- The label for which candidates should be generated
Returns
- ↪IEnumerable<LabelCandidate>
- The LabelCandidates that describe valid label positions