Hit-testing allows you to recognize which element is located at the specified screen coordinates. For instance, you may have to determine which chart element has been clicked or double-clicked by an end-user.
To obtain this information, use the ChartControl.CalcHitInfo method. This method accepts a test dependency object and returns the hit info object, containing information about the test object’s position within a chart.
All information about hit-testing is represented by the ChartHitInfo object, which contains information about a specific point within a chart.
The ChartHitInfo class properties can be grouped into two categories:
- The properties that indicate whether the test point resides over a particular view element. For instance, the ChartHitInfoBase.InAxis property indicates whether the test point is over the axis;
- The properties identifying the topmost visual element, which contains the test point (e.g. ChartHitInfoBase.Axis).
If you want to learn how to utilize this feature with DXCharts, see the following tutorials:
- How to: Determine which Chart Element is Hovered by the Mouse Pointer
- How to: Display Custom Tooltips for Series Points