Chart.HitTest Method (Int32, Int32, Boolean)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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.

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

public HitTestResult HitTest(
	int x,
	int y,
	bool ignoreTransparent


Type: System.Int32

The X-coordinate value of the point the user clicked on.

Type: System.Int32

The Y-coordinate value of the point the user clicked on.

Type: System.Boolean

A flag that determines if transparent elements are ignored.

Return Value

Type: System.Web.UI.DataVisualization.Charting.HitTestResult

A HitTestResult object, which provides information concerning the chart element, if any, that is at the specified location.

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

To ignore transparent elements, set the ignoreTransparent parameter to true.


In order for this method to work correctly, the IsMapEnabled property must be set to false.

This method can be used with the Click server-side event when you implement drilldown. However, it is highly recommended that you use client-side image maps for drilldown because of ease of use.

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
Available since 4.0
Return to top