Organic Layout with Edge Labeling
This demo shows how to configure the OrganicLayout for automatic edge
label placement.
Label Placement
Label models and their
parameters control where labels appear. For manuel
placements, it's common to use models that limit possible positions. However, for
automatic layout, it's best to use unrestricted models like
FreeEdgeLabelModel for maximum flexibility.
You can further guide label placement using
EdgeLabelPreferredPlacement, which specifies preferences such as
placing labels near the edge's source or target, on a particular side, or with a
specific rotation. For better results when using organic layout, both the side and angle
of the labels relative to the edge path should be specified.
Note that self-loops and parallel edges are handled by
SelfLoopRouter and ParallelEdgeRouter respectively.
Thus, labels of such edges are not considered by the organic layout algorithm. To place
the labels of these edges, a GenericLabeling algorithm has to be
applied as a post-processing step.
Things to Try
-
Observe "Source" and "Parallel Source" labels near the edge's
source node.
-
Observe "Target" and "Parallel Target" labels near the target node.
-
Check how labels on parallel edges and self-loops are handled by the generic labeling
algorithm.
Demos
Documentation