A LabelCandidate that is associated with a label model parameter.
Remarks
Type Details
- yFiles module
- view-layout-bridge
Constructors
ExtendedEdgeLabelCandidate
(orientedBox: OrientedRectangle, parameter: any, allowOwnerOverlap: boolean, weight?: number)Returns a new instance of ExtendedEdgeLabelCandidate.
Parameters
A map of options to pass to the method.
- orientedBox - OrientedRectangle
- the label size and orientation
- parameter - any
- the parameters of the labeling model associated with this candidate.
- allowOwnerOverlap - boolean
- flag whether the candidate is allowed to overlap the layout of the edge.
- weight - number
- the weight associated with the label candidate
Throws
- Exception({ name: 'ArgumentError' })
- if the weight does not lie in the interval [0,1]
Properties
Gets the bounds of this candidate.
Remarks
Implements
Indicates whether the label candidate intersects an edge that is not the owner of the label candidate.
Remarks
Property Value
true
if the candidate intersects an edge that is not the owner of the label, false
otherwiseExamples
layoutData.nodeLabelCandidateProcessors.constant = (
candidates: IEnumerable<LabelCandidate>,
_: ILabel | LayoutNodeLabel,
) => {
for (const candidate of candidates.filter((c) => c.intersectsEdge)) {
// candidates that intersect edges should not be selected
candidate.weight = 0
}
}
Defined in
Indicates whether the label candidate intersects a layout grid line.
Remarks
Property Value
true
if the candidate intersects a layout grid line, false
otherwiseExamples
layoutData.nodeLabelCandidateProcessors.constant = (
candidates: IEnumerable<LabelCandidate>,
_: ILabel | LayoutNodeLabel,
) => {
for (const candidate of candidates.filter(
(c) => c.intersectsLayoutGridLine,
)) {
// candidates that intersect a layout grid line should not be selected
candidate.weight = 0
}
}
Defined in
Indicates whether the label candidate intersects a node that is not the owner of the label candidate.
Remarks
Property Value
true
if the candidate intersects a node that is not the owner of the label, false
otherwiseExamples
layoutData.nodeLabelCandidateProcessors.constant = (
candidates: IEnumerable<LabelCandidate>,
_: ILabel | LayoutNodeLabel,
) => {
for (const candidate of candidates.filter((c) => c.intersectsNode)) {
// candidates that intersect nodes should not be selected
candidate.weight = 0
}
}
Defined in
Indicates whether the label candidate intersects with an edge of an edge that is grouped with the label's edge.
Remarks
The value is set at the beginning of the run of GenericLabeling and can be subsequently used for customizing the weight of the candidate; see also nodeLabelCandidateProcessors and nodeLabelCandidateProcessors.
This property is only relevant for labels of edges. Further, if the label candidate intersects its owner edge, but no other edge of the owner's edge group, this property is false
; see also intersectsOwner.
An edge group is a set of edges which share a common bus near the target or source node. They are defined with sourceGroupIds and targetGroupIds.
Property Value
true
if the label candidate intersects with an edge of an edge that is grouped with the label's edge, false
otherwiseExamples
layoutData.edgeLabelCandidateProcessors.constant = (
candidates: IEnumerable<LabelCandidate>,
_: ILabel | LayoutEdgeLabel,
) => {
for (const candidate of candidates.filter(
(c) => c.intersectsOwnEdgeGroup,
)) {
// candidates that intersect an edge of the owner's edge group should not be selected
candidate.weight = 0
}
}
Sample Graphs
Defined in
Indicates whether the label candidate intersects the label's owner, i.e., the corresponding node or edge.
Remarks
Property Value
true
if the candidate intersects the label's owner, false
otherwiseExamples
layoutData.nodeLabelCandidateProcessors.constant = (
candidates: IEnumerable<LabelCandidate>,
_: ILabel | LayoutNodeLabel,
) => {
for (const candidate of candidates.filter((c) => c.intersectsOwner)) {
// candidates that intersect the owner of the label node should not be selected
candidate.weight = 0
}
}
Defined in
Gets the oriented box of this candidate.
Gets or sets the weight for this candidate.
Remarks
The weight describes the priority of this candidate with respect to other candidates. Labeling algorithms will use the weight to decide which candidate to choose. Positions with a higher weight are more likely chosen.
The value is restricted to the interval [0,1]
, where 1
specifies the highest possible weight.
The labeling algorithm automatically calculates the weights for each valid label position considering user specified properties like the associated LabelingCosts and EdgeLabelPreferredPlacement. There are also multiple ways to manually specify the weight values, e.g., as a parameter of a predefined candidate set (see addDiscreteCandidates) or by means of property edge label candidate processor and node label candidate processor.
Default Value
1.0
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified value lies outside of
[0,1]