Chart.HitTest Method (Int32, Int32)

Determines the chart element, if any, that 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
)

Parameters

x
Type: System.Int32

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

y
Type: System.Int32

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

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.

Important noteImportant

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

Supported in: 4.5.2, 4.5.1, 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
Show:
© 2014 Microsoft