| uid | annotationsAPIs.BrushAnnotationCreationModifier |
|---|
The xref:com.scichart.charting.modifiers.BrushAnnotationCreationModifier is a chart modifier that allows for freehand creation of xref:com.scichart.charting.visuals.annotations.tradingAnnotations.BrushAnnotation instances.
When this modifier is enabled and added to a xref:com.scichart.charting.visuals.SciChartSurface, users can draw freehand strokes directly on the chart using touch gestures. The modifier automatically creates a new BrushAnnotation and populates it with points based on the user's movement.
The following properties can be used to configure the BrushAnnotationCreationModifier:
| Property | Description |
|---|---|
| brushColor | Sets the color of the brush stroke for the annotations created by this modifier. |
| brushThickness | Sets the thickness of the brush stroke for the annotations created by this modifier. |
| xAxisId | Sets the ID of the X-Axis that the created annotations should be measured against. |
| yAxisId | Sets the ID of the Y-Axis that the created annotations should be measured against. |
You can receive a notification when an annotation is created by setting an xref:com.scichart.charting.modifiers.OnAnnotationCreatedListener:
- setAnnotationCreationListener(OnAnnotationCreatedListener listener): Passes the newly created annotation instance to the listener.
The following code demonstrates how to add and configure a BrushAnnotationCreationModifier:
[!code-javaAddBrushAnnotationCreationModifier]
[!code-swiftAddBrushAnnotationCreationModifier]
You can customize the behavior of the BrushAnnotationCreationModifier by extending it and overriding its touch event methods. This allows you to add custom logic before or after an annotation is created.
[!code-javaCustomBrushAnnotationCreationModifier]
[!code-swiftCustomBrushAnnotationCreationModifier]
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.