Back to Devexpress

ChartHitInfo.HitTest Property

corelibraries-devexpress-dot-xtracharts-dot-charthitinfo-68a7a2cd.md

latest4.6 KB
Original Source

ChartHitInfo.HitTest Property

Gets a value identifying the type of the visual element located under the test point.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public ChartHitTest HitTest { get; }
vb
Public ReadOnly Property HitTest As ChartHitTest

Property Value

TypeDescription
ChartHitTest

A ChartHitTest enumeration value which identifies the type of the visual element that contains the test point.

|

Available values:

Show 16 items

NameDescription
None

The test point does not belong to any visual element or is outside the chart.

| | Chart |

The test point belongs to a chart.

| | ChartTitle |

The test point belongs to a chart title.

| | Axis |

The test point belongs to an axis.

| | ConstantLine |

The test point belongs to a constant line.

| | Diagram |

The test point belongs to a diagram.

| | Legend |

The test point belongs to a legend.

| | Series |

The test point belongs to a series.

| | SeriesLabel |

The test point belongs to a series label.

| | SeriesTitle |

The test point belongs to a series title.

| | NonDefaultPane |

The test point belongs to a non-default pane.

| | TrendLine |

Obsolete. The test point belongs to a trend line.

| | FibonacciIndicator |

Obsolete. The test point belongs to a Fibonacci Indicator.

| | RegressionLine |

Obsolete. The test point belongs to a regression line.

| | Annotation |

The test point belongs to an annotation.

| | Indicator |

The test point belongs to an indicator.

|

Example

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.

csharp
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();
}
vb
Imports System.Windows.Forms
Imports DevExpress.XtraCharts
' ...

Private Sub ChartControl1_MouseMove(ByVal sender As System.Object, ByVal e As MouseEventArgs) _
Handles ChartControl1.MouseMove
    Dim hi As ChartHitInfo = ChartControl1.CalcHitInfo(New System.Drawing.Point(e.X, e.Y))
    Me.Text = hi.HitTest.ToString()
End Sub

See Also

ChartHitInfo Class

ChartHitInfo Members

DevExpress.XtraCharts Namespace