Class XabcdAnnotationCreationModifier
A modifier for creating XabcdAnnotation instances via a multipoint tap-to-place workflow.
Each touch-up places the next base point (X, A, B, C, D). A rubber-band preview line is shown between the last confirmed point and the current touch position.
After the fifth point is placed the annotation is finalized and the OnAnnotationCreatedListener is notified.
Extensibility: This modifier is designed to be easily subclassed.
Override any of the following protected methods to customize behavior:
- #createAnnotation(Context) \u2014 replace the XABCD annotation type
- #createRubberBandAnnotation(Context) \u2014 replace the rubber-band preview line with any annotation type (e.g. a different line, arrow, or custom annotation)
- #configureRubberBandAnnotation(IAnnotation) \u2014 configure the rubber-band annotation after creation (styling, etc.)
- #updateRubberBandEndPoint(PointF) \u2014 change how the rubber-band tracks the finger
- #removeRubberBandAnnotation() \u2014 clean up the rubber-band annotation
- #onAnnotationCreated(IAnnotation) \u2014 react to annotation completion
Rubber-band styling can also be changed without subclassing by using #setRubberBandStroke(PenStyle).
Inheritance
Inherited Members
Namespace:
Assembly: .dll
Syntax
public class XabcdAnnotationCreationModifier extends TouchModifierBase
Constructors
XabcdAnnotationCreationModifier()
Declaration
public XabcdAnnotationCreationModifier()
Methods
configureRubberBandAnnotation(IAnnotation annotation)
Configures the rubber-band preview annotation after creation.
By default, this sets the axis IDs, disables editing, and applies the current rubberBandStroke.
Override this method to apply custom configuration to the rubber-band annotation (e.g. different colors per segment, opacity, etc.).
Declaration
protected void configureRubberBandAnnotation(IAnnotation annotation)
Parameters
| Type | Name | Description |
|---|---|---|
| IAnnotation | annotation | the rubber-band annotation to configure |
createAnnotation(Context context)
Creates a new XabcdAnnotation instance to be placed on the chart.
Override this method to return a custom subclass of XabcdAnnotation with different default styling, behavior, or properties.
Example:
@Override
protected XabcdAnnotation createAnnotation(Context context) {
XabcdAnnotation annotation = new XabcdAnnotation(context);
annotation.setStroke(new SolidPenStyle(Color.RED, true, 3f, null));
annotation.setFill(new SolidBrushStyle(Color.argb(50, 255, 0, 0)));
return annotation;
}
Declaration
protected tradingAnnotations.XabcdAnnotation createAnnotation(Context context)
Parameters
| Type | Name | Description |
|---|---|---|
| Context | context | the Android context |
Returns
| Type | Description |
|---|---|
| tradingAnnotations.XabcdAnnotation | a new XabcdAnnotation instance; must not be |
createOrUpdateRubberBandAnnotation(PointF fromPoint)
Creates or repositions the rubber-band preview annotation starting from the given point. This annotation is a separate entity managed by the modifier, NOT part of the XABCD annotation's internal structure, so it avoids ghost-line artifacts.
Override this to change when or how the rubber-band annotation is created and positioned.
Declaration
protected void createOrUpdateRubberBandAnnotation(PointF fromPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | fromPoint | the starting point for the rubber-band (last confirmed touch) |
createRubberBandAnnotation(Context context)
Creates the rubber-band preview annotation used to show the next segment while the user is placing points.
By default, this creates a LineAnnotation. Override this method to use any other annotation type (e.g. an arrow annotation, a custom drawn annotation, etc.).
After creation, #configureRubberBandAnnotation(IAnnotation) is called to apply styling.
Contract: The returned annotation must support having its coordinates set via #setRubberBandAnnotationPoints(IAnnotation, PointF, PointF). If you return a non-LineAnnotation type, you must also override #setRubberBandAnnotationPoints(IAnnotation, PointF, PointF).
Declaration
protected IAnnotation createRubberBandAnnotation(Context context)
Parameters
| Type | Name | Description |
|---|---|---|
| Context | context | the Android context |
Returns
| Type | Description |
|---|---|
| IAnnotation | a new annotation instance to use as the rubber-band preview |
getCurrentAnnotation()
Gets the XabcdAnnotation currently being created, or null
if no creation is in progress.
Declaration
public final tradingAnnotations.XabcdAnnotation getCurrentAnnotation()
Returns
| Type | Description |
|---|---|
| tradingAnnotations.XabcdAnnotation | the current in-progress annotation, or |
getCurrentPointIndex()
Gets the index of the next base point to be placed (0-based).
This is useful in subclasses to know which point is about to be placed.
Declaration
public final int getCurrentPointIndex()
Returns
| Type | Description |
|---|---|
| int | the current point index (0 = X, 1 = A, 2 = B, 3 = C, 4 = D) |
getRubberBandAnnotation()
Gets the rubber-band preview annotation currently displayed, or
null if none is visible.
Declaration
public final IAnnotation getRubberBandAnnotation()
Returns
| Type | Description |
|---|---|
| IAnnotation | the current rubber-band annotation, or |
getRubberBandStroke()
Gets the PenStyle currently used for the rubber-band preview line.
Declaration
public final PenStyle getRubberBandStroke()
Returns
| Type | Description |
|---|---|
| PenStyle | the current rubber-band pen style |
getXAxisId()
Gets the xAxis id for annotations created by this modifier.
Declaration
public final String getXAxisId()
Returns
| Type | Description |
|---|---|
| String |
getYAxisId()
Gets the yAxis id for annotations created by this modifier.
Declaration
public final String getYAxisId()
Returns
| Type | Description |
|---|---|
| String |
onAnnotationCreated(IAnnotation newAnnotation)
Called when the XABCD annotation is fully created (all base points placed).
Override this to perform additional post-creation actions (e.g. select the
annotation, apply final styling, show a toolbar, etc.). Call
super.onAnnotationCreated() to ensure the listener is notified.
Declaration
protected void onAnnotationCreated(IAnnotation newAnnotation)
Parameters
| Type | Name | Description |
|---|---|---|
| IAnnotation | newAnnotation | the completed annotation |
onTouchDown(ModifierTouchEventArgs args)
Called when MotionEvent#ACTION_DOWN event occurs
Declaration
protected boolean onTouchDown(ModifierTouchEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| ModifierTouchEventArgs | args |
Returns
| Type | Description |
|---|---|
| boolean |
Overrides
onTouchMove(ModifierTouchEventArgs args)
Called when MotionEvent#ACTION_MOVE event occurs
Declaration
protected boolean onTouchMove(ModifierTouchEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| ModifierTouchEventArgs | args |
Returns
| Type | Description |
|---|---|
| boolean |
Overrides
onTouchUp(ModifierTouchEventArgs args)
Called when MotionEvent#ACTION_UP event occurs
Declaration
protected boolean onTouchUp(ModifierTouchEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| ModifierTouchEventArgs | args |
Returns
| Type | Description |
|---|---|
| boolean |
Overrides
removeRubberBandAnnotation()
Removes the rubber-band preview annotation from the surface.
Override this to perform additional cleanup when the rubber-band is removed (e.g. dispose resources, animate out, etc.).
Declaration
protected void removeRubberBandAnnotation()
setAnnotationCreationListener(OnAnnotationCreatedListener listener)
Sets the OnAnnotationCreatedListener called when the XABCD annotation is fully created (all 5 points placed).
Declaration
public final void setAnnotationCreationListener(OnAnnotationCreatedListener listener)
Parameters
| Type | Name | Description |
|---|---|---|
| OnAnnotationCreatedListener | listener |
setBasePointFor(tradingAnnotations.TradingAnnotationBase annotation, PointF point)
Sets a base point on the trading annotation at the given touch position. Only called on touch-up to avoid triggering internal ghost-line artifacts.
Override this to apply coordinate transformations (e.g. snapping to data points, rounding, constraining to ranges, etc.).
Declaration
protected void setBasePointFor(tradingAnnotations.TradingAnnotationBase annotation, PointF point)
Parameters
| Type | Name | Description |
|---|---|---|
| tradingAnnotations.TradingAnnotationBase | annotation | the trading annotation being created |
| PointF | point | the touch position in pixel coordinates |
setLinePoint(LineAnnotation line, PointF point, boolean isStart)
Sets either the start (X1/Y1) or end (X2/Y2) of a LineAnnotation from a touch-coordinate point.
Declaration
protected static void setLinePoint(LineAnnotation line, PointF point, boolean isStart)
Parameters
| Type | Name | Description |
|---|---|---|
| LineAnnotation | line | |
| PointF | point | |
| boolean | isStart |
|
setRubberBandAnnotationPoints(IAnnotation annotation, PointF fromPoint, PointF toPoint)
Sets both the start and end points of the rubber-band preview annotation.
By default, this handles LineAnnotation by setting X1/Y1 and X2/Y2. If you override #createRubberBandAnnotation(Context) to return a different annotation type, you must also override this method.
Declaration
protected void setRubberBandAnnotationPoints(IAnnotation annotation, PointF fromPoint, PointF toPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| IAnnotation | annotation | the rubber-band annotation |
| PointF | fromPoint | the start point (last confirmed touch position) in pixel coordinates |
| PointF | toPoint | the end point (current touch position) in pixel coordinates |
setRubberBandStroke(PenStyle stroke)
Sets the PenStyle used for the rubber-band preview line.
This allows changing the color, thickness, dash pattern, etc. of the rubber-band line without subclassing.
If a rubber-band line is currently visible, it will be updated on the next touch event.
Declaration
public final void setRubberBandStroke(PenStyle stroke)
Parameters
| Type | Name | Description |
|---|---|---|
| PenStyle | stroke | the pen style to use; must not be |
setXAxisId(String xAxisId)
Sets the xAxis id for annotations created by this modifier.
Declaration
public final void setXAxisId(String xAxisId)
Parameters
| Type | Name | Description |
|---|---|---|
| String | xAxisId |
setYAxisId(String yAxisId)
Sets the yAxis id for annotations created by this modifier.
Declaration
public final void setYAxisId(String yAxisId)
Parameters
| Type | Name | Description |
|---|---|---|
| String | yAxisId |
updateRubberBandEndPoint(PointF toPoint)
Updates the endpoint of the rubber-band annotation to follow the finger.
Override this to change the tracking behavior (e.g. snap to grid, constrain to axis, etc.).
Declaration
protected void updateRubberBandEndPoint(PointF toPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | toPoint | the current touch position in pixel coordinates |