Class MeasureAnnotationCreationModifier
A modifier for creating MeasureAnnotation instances via a two-point tap-to-place or
single continuous drag workflow.
If the finger moves beyond a small threshold before the first touch-up, both anchor points
are placed immediately from the drag gesture and the annotation is finalized. Otherwise, each
touch-up places the next anchor point (start, then end) with a rubber-band preview line shown
between the last confirmed point and the current touch position.
If #setSnapSeries(IRenderableSeries) is set, both anchor points snap to the nearest
rendered data point of that series while being placed - the actual snap-distance-threshold
logic lives on MeasureAnnotation itself, so it also applies to vertex/body drags made
after creation.
Extensibility: This modifier is designed to be easily subclassed. Override any of the
following protected methods to customize behavior:
Inheritance
MeasureAnnotationCreationModifier
Namespace:
Assembly: .dll
Syntax
public class MeasureAnnotationCreationModifier extends TouchModifierBase
Constructors
MeasureAnnotationCreationModifier()
Declaration
public MeasureAnnotationCreationModifier()
Methods
Configures the rubber-band preview annotation after creation.
Declaration
protected void configureRubberBandAnnotation(IAnnotation annotation)
Parameters
createAnnotation(Context context)
Creates a new MeasureAnnotation instance to be placed on the chart.
Override this method to return a custom subclass with different default styling.
Declaration
protected tradingAnnotations.MeasureAnnotation createAnnotation(Context context)
Parameters
| Type |
Name |
Description |
| Context |
context |
|
Returns
createOrUpdateRubberBandAnnotation(PointF fromPoint)
Declaration
protected void createOrUpdateRubberBandAnnotation(PointF fromPoint)
Parameters
| Type |
Name |
Description |
| PointF |
fromPoint |
|
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.
Declaration
protected IAnnotation createRubberBandAnnotation(Context context)
Parameters
| Type |
Name |
Description |
| Context |
context |
|
Returns
getCurrentAnnotation()
Gets the MeasureAnnotation currently being created, or null if no creation is in progress.
Declaration
public final tradingAnnotations.MeasureAnnotation getCurrentAnnotation()
Returns
getCurrentPointIndex()
Gets the index of the next anchor point to be placed (0-based: 0 = start, 1 = end).
Declaration
public final int getCurrentPointIndex()
Returns
getRubberBandAnnotation()
Declaration
public final IAnnotation getRubberBandAnnotation()
Returns
getRubberBandStroke()
Declaration
public final PenStyle getRubberBandStroke()
Returns
getSnapSeries()
Gets the renderable series that new/created MeasureAnnotation instances should snap to, or null.
Declaration
public final renderableSeries.IRenderableSeries getSnapSeries()
Returns
getXAxisId()
Declaration
public final String getXAxisId()
Returns
getYAxisId()
Declaration
public final String getYAxisId()
Returns
onAnnotationCreated(IAnnotation newAnnotation)
Called when the Measure annotation is fully created (both anchor points placed).
Declaration
protected void onAnnotationCreated(IAnnotation newAnnotation)
Parameters
onTouchDown(ModifierTouchEventArgs args)
Called when MotionEvent#ACTION_DOWN event occurs
Declaration
protected boolean onTouchDown(ModifierTouchEventArgs args)
Parameters
Returns
Overrides
onTouchMove(ModifierTouchEventArgs args)
Called when MotionEvent#ACTION_MOVE event occurs
Declaration
protected boolean onTouchMove(ModifierTouchEventArgs args)
Parameters
Returns
Overrides
onTouchUp(ModifierTouchEventArgs args)
Called when MotionEvent#ACTION_UP event occurs
Declaration
protected boolean onTouchUp(ModifierTouchEventArgs args)
Parameters
Returns
Overrides
removeRubberBandAnnotation()
Declaration
protected void removeRubberBandAnnotation()
setAnnotationCreationListener(OnAnnotationCreatedListener listener)
Declaration
public final void setAnnotationCreationListener(OnAnnotationCreatedListener listener)
Parameters
setBasePointFor(tradingAnnotations.TradingAnnotationBase annotation, PointF point)
Sets a base point on the trading annotation at the given touch position. Only called on
touch-up (or from a resolved drag gesture) to avoid triggering internal ghost-line artifacts.
Declaration
protected void setBasePointFor(tradingAnnotations.TradingAnnotationBase annotation, PointF point)
Parameters
setLinePoint(LineAnnotation line, PointF point, boolean isStart)
Declaration
protected static void setLinePoint(LineAnnotation line, PointF point, boolean isStart)
Parameters
setRubberBandAnnotationPoints(IAnnotation annotation, PointF fromPoint, PointF toPoint)
Sets both the start and end points of the rubber-band preview annotation.
Declaration
protected void setRubberBandAnnotationPoints(IAnnotation annotation, PointF fromPoint, PointF toPoint)
Parameters
| Type |
Name |
Description |
| IAnnotation |
annotation |
|
| PointF |
fromPoint |
|
| PointF |
toPoint |
|
setRubberBandStroke(PenStyle stroke)
Declaration
public final void setRubberBandStroke(PenStyle stroke)
Parameters
setSnapSeries(renderableSeries.IRenderableSeries snapSeries)
Sets the renderable series that new MeasureAnnotation instances should snap to. Pass null to disable snapping.
Declaration
public final void setSnapSeries(renderableSeries.IRenderableSeries snapSeries)
Parameters
setXAxisId(String xAxisId)
Declaration
public final void setXAxisId(String xAxisId)
Parameters
| Type |
Name |
Description |
| String |
xAxisId |
|
setYAxisId(String yAxisId)
Declaration
public final void setYAxisId(String yAxisId)
Parameters
| Type |
Name |
Description |
| String |
yAxisId |
|
updateRubberBandEndPoint(PointF toPoint)
Declaration
protected void updateRubberBandEndPoint(PointF toPoint)
Parameters
| Type |
Name |
Description |
| PointF |
toPoint |
|