DiagramLinks-s consist of series of straight or Bezier segments and arrowhead shapes. The link and arrowhead shapes, and also color attributes and text can be customized as detailed below:
Your link can be straight or curved and can have one or more segments. Call DiagramLink.setShape to change the shape. It takes as an argument one of the LinkShape enumeration values:
JavaScript
![]() |
---|
myLink.setShape(LinkShape.Cascading); |
The link can further be customized by changing its control points - they specify the position of the link. The number of control points per segment depends on the link's Shape: Bezier links have four control points per segment. Each straight segment has two control points. Adjacent segments share a control point.
The following code sets three control points of a polyline link which has two segments:
JavaScript
![]() |
---|
var Point = MindFusion.Drawing.Point; |
![]() |
---|
Always call DiagramLink.updateFromPoints() after you have changed the control points of a link. |
Each link can start and end with a shape. The shape at the start is called BaseShape, the shape at the end is called HeadShape. The methods that set the shapes are setBaseShape and setHeadShape. They take as argument either the Shape to set or a string that identifies it:
JavaScript
![]() |
---|
myLink.setHeadShape("BowArrow"); |
The Shape identifiers are also exposed as static members of the Shapes class.
Link lines are rendered according to Stroke, StrokeThickness and StrokeDashStyle attributes. The shapes at the head and base are filled with HeadBrush and BaseBrush. To access them use setHeadBrush and setBaseBrush as shown below:
JavaScript
![]() |
---|
//paints the link head with red brush |
Use setText to set a label of your link, setFont specifies the font. Here is an example how to do this:
JavaScript
![]() |
---|
myLink.setText("myLabel"); var Font = MindFusion.Drawing.Font; //the two boolean arguments specify whether the font is bold and italic |