Chart.HitTest Method (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.

Namespace:  System.Web.UI.DataVisualization.Charting
Assembly:  System.Web.DataVisualization (in System.Web.DataVisualization.dll)

public HitTestResult[] HitTest(
	int x,
	int y,
	bool ignoreTransparent,
	params ChartElementType[] requestedElement


Type: System.Int32

The X-coordinate for the specified data point.

Type: System.Int32

The Y-coordinate for the specified data point.

Type: System.Boolean

A flag that indicates that transparent elements should be ignored.

Type: System.Web.UI.DataVisualization.Charting.ChartElementType[]

An array of ChartElementType objects that specify the types to test for, in order to filter the result. If omitted, checking for element types will be ignored and all element types will be valid.

Return Value

Type: System.Web.UI.DataVisualization.Charting.HitTestResult[]
An array of T[:System.Web.UI.DataVisualization.Charting.HitTestResult] objects that provides information about the chart element, if any, found at the specified location. The array contains at least one element, which can be Nothing. The objects in the result are sorted from the top to the bottom of different layers of control.

Call this method to determine the gauge element, if any, which is located at a specified point. This method is often used in some mouse-related event, for example, MouseDown, to determine which gauge 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 returned HitTestResult object 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.

.NET Framework

Supported in: 4.6, 4.5, 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft