Styles-related Features

Arrows

Abstract class DefaultArrow provides support for the graphical decorations that can be placed at an edge's ends. Normally, this decoration is some kind of arrowhead that is used to indicate the edge's direction.

Figure 2.22. DefaultArrow

DefaultArrow.

DefaultArrow makes available a number of predefined arrowhead renderings which can be directly used with the sourceArrow and targetArrow properties defined in abstract class AbstractEdgeStyle. Example 2.27, “Setting arrows with an edge style” shows how to use the static create methods from DefaultArrow to create arrows and set them as the decoration for the source and target ends of edges.

Figure 2.23. Different arrows at the source and target ends of an edge

Different arrows at the source and target ends of an edge.

Example 2.27. Setting arrows with an edge style

var pes:PolylineEdgeStyle = new PolylineEdgeStyle();
pes.stroke = Strokes.RED;
pes.sourceArrow = DefaultArrow.create(ArrowType.CIRCLE, Strokes.RED, 
                                      new SolidColor());
pes.targetArrow = DefaultArrow.create(ArrowType.SPEARHEAD, Strokes.RED, 
                                      new SolidColor());

The predefined arrows can be accessed by means of the constants defined in class ArrowType. The corresponding renderings are shown in Table 2.15, “Predefined arrowhead renderings”. The table also shows the availability of the various arrow types in the yFiles Java and yFiles.NET libraries.

Note that omitting the decoration is done using ArrowType.NONE, which provides an empty "rendering."

Table 2.15. Predefined arrowhead renderings

Arrow Type Rendering yFiles Java yFiles.NET
DEFAULT
+ (*) + (*)
SPEARHEAD
- -
CIRCLE
- +
CROSS
+ +
DELTA
+ -
DIAMOND
+ +
SHORT
+ +
SIMPLE
- +
CONCAVE
+ -
CONVEX
+ -
DASH
+ -
SKEWED_DASH
+ -
T_SHAPE
+ -

(*) Arrow type available, but the actual rendering may differ.