SciChart iOS v2.x API > Annotations API > The LineAnnotation Type
The LineAnnotation Type

The SCILineAnnotation type draws a line from X1Y1 to X2Y2, where coordinates are data-values.

Examples for the Annotations API can be found in the SciChart iOS Examples Suite.

Declaring a LineAnnotation in Code

Use the following code to add a LineAnnotation to a chart.

SCILineAnnotation * lineAnnotationRelative = [SCILineAnnotation new];
lineAnnotationRelative.coordinateMode = SCIAnnotationCoordinate_Absolute;
lineAnnotationRelative.x1 = SCIGeneric(x1);
lineAnnotationRelative.y1 = SCIGeneric(y1);
lineAnnotationRelative.x2 = SCIGeneric(x2);
lineAnnotationRelative.y2 = SCIGeneric(y2);
lineAnnotationRelative.style.linePen = [[SCISolidPenStyle alloc] initWithColorCode:color withThickness:strokeThickness];
[surface.annotations add:lineAnnotationRelative];
let lineAnnotationRelative = SCILineAnnotation();
lineAnnotationRelative.coordinateMode = .absolute;
lineAnnotationRelative.x1 = SCIGeneric(x1);
lineAnnotationRelative.y1 = SCIGeneric(y1);
lineAnnotationRelative.x2 = SCIGeneric(x2);
lineAnnotationRelative.y2 = SCIGeneric(y2);
lineAnnotationRelative.style.linePen = SCISolidPenStyle.init(colorCode:color, withThickness:Float(strokeThickness));
 
surface.annotations.add(lineAnnotationRelative);

 

See Also