Achieving Non-Overlapping Node and Edge Labeling |
| Applies to: yFiles 2.6, yFiles 2.5, yFiles 2.4, yFiles 2.3, yFiles 2.2, yFiles 2.1, yFiles 2.0 |
Categories this article belongs to:
| yFiles for Java | > yFiles Layout | > Automatic Graph Layout | > Automatic Label Placement |
Package
y.layout.labeling contains the algorithms for the generic approach, e.g., class
GreedyMISLabeling
.
The layout algorithms that have label placement seamlessly integrated are
HierarchicLayouter
,
HierarchicGroupLayouter
, IncrementalHierarchicLayouter
, and
OrthogonalLayouter
.
Generic Label Placement
The algorithms that follow the generic approach try to find label positions that do not overlap other graph elements. To this end, they can choose from a set of predefined label positions, that have been associated with a label by means of a so-called "label model."
Node labels and edge labels provide several type-specific label models, each having a predefined set of valid label positions.
With class NodeLabel
, for example, label model NodeLabel.CORNERS
has four valid label positions.
These are at the corners of a node, i.e., outside its bounds.
The tutorial source code demos LabelingDemo.java and LabelingModule.java show how to use these labeling algorithms.
Integrated Label Placement
The layout algorithms where labeling is integrated into the layout process itself can calculate a graph layout with respect to label position and size. That way, non-overlapping label positions can be guaranteed.
The tutorial source code demo HierarchicLayoutModule.java shows how to configure both generic approach as well as integrated edge labeling for class HierarchicLayouter.
| Keywords: | automatic - label - placement - non-overlapping - labeling - node - edge - generic - integrated - overlap - minimize |


