NOTE: The xAxisId and yAxisId must be supplied if you have axis with non-default Axis Ids, e.g. in multi-axis scenario.
Also, because SCITextAnnotation is derived from the SCIAnchorPointAnnotation it can be aligned relative to the X1 or Y1 coordinate by setting the Anchor Points. For more information about the Anchor Points - refer to the corresponding section Annotations APIs article.
A SCITextAnnotation can be added onto a chart using the following code:
// Assume a surface has been created and configured somewhere
id<ISCIChartSurface> surface;
// Create SCICustomAnnotation instance
SCITextAnnotation *textAnnotation = [SCITextAnnotation new];
// Set the text
textAnnotation.text = @“Text can be Rotated”;
// Specify a SCIFontStyle for the text
textAnnotation.fontStyle = [[SCIFontStyle alloc] initWithFontSize:20 andTextColorCode:0xBBFC9C29];
// Specify rotation Angle in Degrees if needed
textAnnotation.rotationAngle = -30;
// Specify a desired position
textAnnotation.x1 = @(20);
textAnnotation.y1 = @(14);
// Allow to interact with the annotation in run-time
textAnnotation.isEditable = YES;
// In a multi-axis scenario, specify the XAxisId and YAxisId
textAnnotation.xAxisId = BottomAxisId;
textAnnotation.yAxisId = LeftAxisId;
// Add the annotation to the Annotations collection of the surface
[self.surface.annotations add:textAnnotation];
// Assume a surface has been created and configured somewhere
let surface: ISCIChartSurface
// Create SCICustomAnnotation instance
let textAnnotation = SCITextAnnotation()
// Set the text
textAnnotation.text = “Text can be Rotated”
// Specify a SCIFontStyle for the text
textAnnotation.fontStyle = = SCIFontStyle(fontSize: 20, andTextColorCode: 0xBBFC9C29)
// Specify rotation Angle in Degrees if needed
textAnnotation.rotationAngle = -30
// Specify a desired position
textAnnotation.set(x1: 20)
textAnnotation.set(y1: 14)
// Allow to interact with the annotation in run-time
textAnnotation.isEditable = true
// In a multi-axis scenario, specify the XAxisId and YAxisId
textAnnotation.xAxisId = BottomAxisId
textAnnotation.yAxisId = LeftAxisId
// Add the annotation to the Annotations collection of the surface
self.surface.annotations.add(textAnnotation)
// Assume a surface has been created and configured somewhere
IISCIChartSurface surface;
// Create SCICustomAnnotation instance
var textAnnotation = new SCITextAnnotation();
// Set the text
textAnnotation.Text = “Text can be Rotated”;
// Specify a SCIFontStyle for the text
textAnnotation.FontStyle = new SCIFontStyle(20, 0xBBFC9C29);
// Specify rotation Angle in Degrees if needed
textAnnotation.RotationAngle = -30;
// Specify a desired position
textAnnotation.X1Value = 20;
textAnnotation.Y1Value = 14;
// Allow to interact with the annotation in run-time
textAnnotation.IsEditable = true;
// In a multi-axis scenario, specify the XAxisId and YAxisId
textAnnotation.XAxisId = BottomAxisId;
textAnnotation.YAxisId = LeftAxisId;
// Add the annotation to the Annotations collection of the surface
Surface.Annotations.Add(textAnnotation);
NOTE: To learn more about other Annotation Types, available out of the box in SciChart, please find the comprehensive list in the Annotation APIs article.
NOTE: Be aware, if you use canEditText (allows edit text in run-time) in conjunction with isEditable (allows drag annotation over that chart), you will need to perform 2 taps - first one to select annotation, and only after that - tap to enter editing.