public static interface

ShinobiChart.OnTrackingInfoChangedForCrosshairListener

com.shinobicontrols.charts.ShinobiChart.OnTrackingInfoChangedForCrosshairListener

Class Overview

Interface definition for a callback to be invoked when the current series and data point tracking information has changed as a result of a user gesture.

Implement this listener when you want to change the default behavior of the crosshair, such as where it is drawn.

To change how the crosshair is drawn use the ShinobiChart.OnCrosshairDrawListener callback interface.

Summary

Public Methods
abstract void onTrackingInfoChanged(Crosshair crosshair, DataPoint<?, ?> dataPoint, DataPoint<?, ?> dataPointPosition, DataPoint<?, ?> interpolatedDataPointPosition)
Defines how the Crosshair reacts to a change in series and data point tracking information as a result of a user gesture.

Public Methods

public abstract void onTrackingInfoChanged (Crosshair crosshair, DataPoint<?, ?> dataPoint, DataPoint<?, ?> dataPointPosition, DataPoint<?, ?> interpolatedDataPointPosition)

Defines how the Crosshair reacts to a change in series and data point tracking information as a result of a user gesture. setFocus(Data) must be called with a non-null Data at some point within this method.

The first parameter, crosshair, is the Crosshair to update as a result of the user gesture. The series that is being tracked can be obtained by calling getTrackedSeries() and from this the axes and chart can also be obtained.

The second parameter, dataPoint, is a copy of the closest data point from the tracked series' data adapter. The definition of closest depends on the various configurable settings on the Crosshair such as its Mode. dataPoint will hold information about whether the corresponding data point in the series' data adapter is selected or not. It can also be safely cast to a MultiValueDataPoint if, and only if, the corresponding actual data point that is being tracked implements the MultiValueData interface.

The third parameter, dataPointPosition, represents an (X, Y) value on the tracked series' axes that corresponds to the visual position of dataPoint. Note, this is the visual position because a data point may not necessarily be placed at its (X, Y) data values, such as when a series is stacked.

The fourth parameter, interpolatedDataPointPosition, represents an (X, Y) value on the tracking series' axes that corresponds to an interpolated position between two data points. This value will be null when the crosshair is tracking a series that does not support interpolation or that has interpolation switched off. Currently, LineSeries is the only series that supports interpolation.

Both dataPointPosition and interpolatedDataPointPosition cannot be cast to a MultiValueDataPoint in any circumstances.

Parameters
crosshair the crosshair to update as a result of the tracking info change from the user gesture
dataPoint a copy of the corresponding data point closest to the user gesture
dataPointPosition a representation of the visual position, in data terms, of dataPoint
interpolatedDataPointPosition a representation of the visual position, in data terms, of the interpolated data point closest to the user gesture, null if interpolation is not supported by the series or switched off by the crosshair