Export (0) Print
Expand All

Chart.HitTest Method

Determines the chart element, if any, that is located at a point defined by the given X and Y coordinates.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method HitTest(Int32, Int32) Determines the chart element, if any, that is located at a point defined by the given X and Y coordinates.
Public method HitTest(Int32, Int32, Boolean) Determines the chart element, if any, that is located at a point defined by given X and Y coordinates. Transparent elements can optionally be ignored.
Public method HitTest(Int32, Int32, ChartElementType) Determines if a chart element of a given type is located at a point defined by given X and Y coordinates.
Public method HitTest(Int32, Int32, Boolean, ChartElementType[]) Determines whether a chart element that is one of the specified types is located at a point defined by the given X and Y coordinates.
Top

Call this method to determine the chart element, if any, that is located at a specified point.

This method is often used in some mouse-related event—for example, [M:System.Windows.Forms.DataVisualization.Charting.Chart.OnMouseDown(System.Windows.Forms.MouseEventArgs]—to determine which chart element the end-user clicked. The X and Y mouse coordinates obtained from the event parameters are then used for the x and y parameter values of this method call.

The properties of the HitTestResult object that is returned can then be used to determine which chart element was clicked; the HitTestResult object also provides an instance of the actual object selected, if any.

Show:
© 2014 Microsoft