ChartControl.HitTest(Int32, Int32) Method
Returns specific chart elements, which are located under the test point.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.1.UI.dll
NuGet Package: DevExpress.Win.Charts
Declaration
Parameters
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. |
Returns
Type | Description |
---|---|
Object[] | An array of Objects, that represent the chart elements located under the test point. |
Remarks
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.
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.
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();
}