Skip to main content

ChartControl.HitTest(Int32, Int32) Method

Returns specific chart elements, which are located under the test point.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v22.2.UI.dll

NuGet Package: DevExpress.Win.Charts


public object[] HitTest(
    int x,
    int y


Name Type Description
x Int32

An integer value that specifies the x coordinate of the test point.

y Int32

An integer value that specifies the y coordinate of the test point.


Type Description

An array of Objects, that represent the chart elements located under the test point.


A SeriesPoint isn’t a chart element. To get the current series point under the test point, you need to use the ChartControl.CalcHitInfo method and use the ChartHitInfo.SeriesPoint property.


The HitTest method is supported in 2D charts only. It can’t be used for 3D charts.


The following examples demonstrates how to handle the ChartControl.MouseMove event and calculate the hit information for the point which the mouse pointer is currently hovering over. Then, the name of the chart element located under the mouse pointer is shown within the form caption.

using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...

private void chartControl1_MouseMove(object sender, MouseEventArgs e) {
    ChartHitInfo hi = chartControl1.CalcHitInfo(new System.Drawing.Point(e.X, e.Y));
    this.Text = hi.HitTest.ToString();
See Also