Overview
TheLine class draws a line shape connecting multiple points. It extends the Graphics base class and supports both simple point arrays and segmented lines.
Class Definition
Settings Interface
Properties
A list of IPoint (x/y coordinates) points for the line.Each
IPoint has the structure:A list of IPoint arrays for different segments of the line.This allows you to create multi-segment lines with gaps or different styling.@since 5.1.4
Inherited Properties
AsLine extends Graphics, it inherits all graphics properties including:
Stroke (line) color.Learn more about colors, gradients and patterns
Width of the stroke (line) in pixels.
Opacity of the stroke (line). 0 - fully transparent; 1 - fully opaque.
Stroke (line) pattern.Learn more about patterns
Stroke (line) gradient.Learn more about gradients
Stroke (line) dash settings.Learn more about dashed lines
Stroke (line) dash offset.Learn more about dashed lines
Color of the element’s shadow.For this to work at least one of the following needs to be set as well:
shadowBlur, shadowOffsetX, shadowOffsetY.Learn more about shadowsBlurriness of the shadow. The bigger the number, the more blurry shadow will be.Learn more about shadows
Horizontal shadow offset in pixels.Learn more about shadows
Vertical shadow offset in pixels.Learn more about shadows
Opacity of the shadow (0-1).If not set, will use the same as
strokeOpacity of the element.Learn more about shadowsDrawing function.Must use renderer (
display parameter) methods to draw.Learn more about custom draw functionsA method to be used on anchor points (joints) of the multi-point line.Learn more about lineJoin@since 5.2.10
This setting determines the shape used to draw the end points of lines.Learn more about lineCap@since 5.10.8
Indicates if stroke of a Graphics should stay the same when its scale changes.Note: This doesn’t take into account parent container scale changes.
Example Usage
Simple Line
Dashed Line
Segmented Line
Simple Line Using Width/Height
Notes
- If neither
pointsnorsegmentsis provided, and no customdrawfunction is set, the line will be drawn from (0, 0) to (width, height). - The
segmentsproperty allows for more complex multi-segment lines with gaps. - Lines are re-rendered when
points,segments, width, or height changes.
See Also
- Graphics documentation
- Polygon - For closed polygon shapes
- Rectangle - For rectangular shapes