Version

Chart Crosshair

This topic explains, with code examples, how to enable and customize the crosshair in the UltraDataChart™ control.

Introduction

In the UltraDataChart control, the crosshair is a set of two perpendicular (vertical and horizontal) lines used to locate with precision a particular point on the chart. The crosshair is helpful when identifying the relationship between some points on the graph that are aligned on or near the same axis values. The lines of the crosshair intersect at the position that corresponds to the horizontal (x-axis) or vertical (y-axis) location of the mouse cursor .

xamDataChart RT Chart Crosshair 01.png

Figure 1: The UltraDataChart control with a custom style for crosshair lines

Enabling the Crosshair

The UltraDataChart crosshair is hidden by default, To make it visible, set the CrosshairVisibility property of the UltraDataChart control; this will make the crosshair appear when the user must hovers the mouse cursor over "] the chart plot area.

The following code snippet demonstrates how to enable crosshairs in the UltraDataChart control.

In C#:

var chart = new UltraDataChart();
chart.CrosshairVisibility = Visibility.Visible;

In Visual Basic:

Dim chart As New UltraDataChart()
chart.CrosshairVisibility = Visibility.Visible