A IProfitModel ranks LabelCandidates used for prioritizing certain label locations over others.
Inheritance Hierarchy
Remarks
Generic labeling algorithm GenericLabeling will use the ranking to decide which LabelCandidates to eliminate.
LabelCandidates with a high profit will be preferred over LabelCandidates with a low profit.
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.IProfitModel
Methods
Returns the profit for placing a label using the given LabelCandidate.
Remarks
Higher profit means better candidates. Hence, there is a higher probability that the candidate is chosen by a labeling algorithm.
Profits need to have a value between 0
and 1
.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- candidate - LabelCandidate
- the candidate
Returns
- ↪number
- the profit of the candidate
Static Methods
Creates an implementation of the interface IProfitModel by using the given function as implementation for its getProfit method.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- getProfit - function(LabelCandidate):number
- A function for IProfitModel's single abstract method getProfit.
Returns
- ↪IProfitModel
- An instance of the IProfitModel interface based on the given function.