SciChart Android 2D Charts API > ChartModifier API > Cursors and Tooltips > Cursor Modifier
Cursor Modifier

Crosshair or Cursor can be added to the SciChartSurface using the CursorModifierIt allows to display a crosshairs at the touch-point and XAxis or YAxis labels. The CursorModifier is also able to display an aggregated tooltip (all series in one tooltip):



CursorModifier Usage

The CursorModifier allows inspecting RenderableSeries at a touch point. For convenience, the actual hit-test position is a bit upper. It is marked with a "sniper aim". Tooltips will appear to the side of it, showing the hit-test result for all the RenderableSeries under the cursor vertical line. Also, the CursorModifier shows labels on axes for its horizontal, vertical lines.

For hit-testing series parts that are close to the chart boundaries, a multi-touch finger drag can be used:


CursorModifier Features

To learn more about the inherited features from TooltipModifierBase and tooltips customization, please refer to the Common Features and Tooltip Customization article. The features from the table below are disctinctive to the CursorModifier:

Feature Description
getOffset()setOffset() Specifies how far the hit-test point is from the actual touch point. This value will be used for either X or Y coordinate, or both, depending on MarkerPlacement.
getCustomPointOffset()setCustomPointOffset() Specifies how far the hit-test point is from the actual touch point. As opposed to Offset, both X and Y coordinate will always be applied.
getMarkerPlacement()setMarkerPlacement() Allows to specify the position of the hit-test point relative to the touch point, e.g. LeftTopBottomRight. Expects a member of the Placement enumeration.
getTooltipPosition()setTooltipPosition() Allows to specify the position of modifier's Toolips relative to the hit-test point, e.g. TopLeftBottomRight. Expects a member of the TooltipPosition enumeration.
getCrosshairPaint() Returns the Paint object that is responsible for the crosshair ("sniper aim") drawing (marking the hit-test point). Can be used to change style and color properties of the crosshair.

Adding a CursorModifier to a Chart

A ChartModifier can be added to a ChartModifiersCollection of a SciChartSurface via the getChartModifiers()setChartModifiers() methods. This can be done using the code below:

Copy Code
// Assume the surface has been created and configured earlier
ISciChartSurface surface;

 // Create a CursorModifier
CursorModifier cursorModifier = new CursorModifier();

 // Add the modifier to the surface

Also a CursorModifier can be created using Chart Builders. To learn more about features available, Please refer to the Common ChartModifiers Features article.

See Also