Hints: Crosshair Cursor
- 3 minutes to read
A Cartesian Chart can show a hint as a standard tooltip or a Crosshair Cursor.
How to: Specify Cartesian Chart’s hint type
Use the following code to specify the Cartesian Chart’s hint type:
DXHint *hint = [[DXHint alloc] init];
DXCrosshairHintBehavior *hintBehavior = [[DXCrosshairHintBehavior alloc] init];
self.chart.hint = hint;
hint.behavior = hintBehavior;
hintBehavior.groupHeaderTextPattern = @"{A$MM/dd/YYYY}";
hintBehavior.maxSeriesCount = 3;
The DXHint.behavior property specifies the hint’s behavior.
The following behaviors are available:
Behavior | Sample Image | Description |
---|---|---|
DXTooltipHintBehavior | The Chart hint behavior specifies if a Tooltip should be available as an interactive hint. | |
DXCrosshairHintBehavior | The Chart hint behavior specifies if a Crosshair Cursor should be available as an interactive hint. |
How to: Configure a hint interaction with an axis
The Cartesian Chart’s hint can interact with an axis, for example, to show a Crosshair line that marks the current value or the current value’s label. The following code demonstrates how to disable a specific axis’ Crosshair line and label:
DXAxisHintOptions *axisHintOptions = [[DXAxisHintOptions alloc] init];
axisHintOptions.hintLabelHidden = YES;
axisHintOptions.hintLineHidden = YES;
axisY.hintOptions = axisHintOptions;
The following symbols configure how the Crosshair Cursor interacts with an axis:
Symbol | Description |
---|---|
DXAxisBase.hintOptions | Gets or sets axis hint options that configure how the Crosshair Cursor interacts with the axis. |
DXAxisHintOptions | The axis hint options storage. |
How to: Snap the Crosshair label to a chart’s corner
The Crosshair label can follow the Crosshair’s argument line or be snapped to any chart corner.
The following sample demonstrates how to snap the Crosshair label to the Chart’s top-right corner:
DXHint *hint = [[DXHint alloc] init];
DXCrosshairHintBehavior *hintBehavior = [[DXCrosshairHintBehavior alloc] init];
DXStaticLabelPosition *crosshairLabelPosition = [[DXStaticLabelPosition alloc] init];
self.chart.hint = hint;
hint.behavior = hintBehavior;
hintBehavior.labelPosition = crosshairLabelPosition;
crosshairLabelPosition.horizontalAlignment = DXLabelPositionHorizontalAlignmentRight;
crosshairLabelPosition.verticalAlignment = DXLabelPositionVerticalAlignmentTop;
The following position modes specify the label’s position:
Position | SampleImage | Description |
---|---|---|
DXStaticCrosshairLabelPosition | The Crosshair Label position specifying that the Crosshair label always is at a position specified by the horizontalAlignment and verticalAlignment properties. | |
DXLineTrackingCrosshairLabelPosition | The Crosshair Label position specifying that the Crosshair label follows the Crosshair Cursor’s argument line. |