Chart.HitTest Method

Definition

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

Overloads

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.

HitTest(Int32, Int32, ChartElementType)

Determines whether a chart element of a given type is located at a point defined by the given X and Y coordinates.

HitTest(Int32, Int32)

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

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.

Remarks

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, MouseDown - 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 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.

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.

public:
 cli::array <System::Web::UI::DataVisualization::Charting::HitTestResult ^> ^ HitTest(int x, int y, bool ignoreTransparent, ... cli::array <System::Web::UI::DataVisualization::Charting::ChartElementType> ^ requestedElement);
public System.Web.UI.DataVisualization.Charting.HitTestResult[] HitTest (int x, int y, bool ignoreTransparent, params System.Web.UI.DataVisualization.Charting.ChartElementType[] requestedElement);
member this.HitTest : int * int * bool * System.Web.UI.DataVisualization.Charting.ChartElementType[] -> System.Web.UI.DataVisualization.Charting.HitTestResult[]
Public Function HitTest (x As Integer, y As Integer, ignoreTransparent As Boolean, ParamArray requestedElement As ChartElementType()) As HitTestResult()

Parameters

x
Int32

The X-coordinate for the specified data point.

y
Int32

The Y-coordinate for the specified data point.

ignoreTransparent
Boolean

A flag that indicates that transparent elements should be ignored.

requestedElement
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.

Returns

An array of 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.

Remarks

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.

HitTest(Int32, Int32, ChartElementType)

Determines whether a chart element of a given type is located at a point defined by the given X and Y coordinates.

public:
 System::Web::UI::DataVisualization::Charting::HitTestResult ^ HitTest(int x, int y, System::Web::UI::DataVisualization::Charting::ChartElementType requestedElement);
public System.Web.UI.DataVisualization.Charting.HitTestResult HitTest (int x, int y, System.Web.UI.DataVisualization.Charting.ChartElementType requestedElement);
member this.HitTest : int * int * System.Web.UI.DataVisualization.Charting.ChartElementType -> System.Web.UI.DataVisualization.Charting.HitTestResult
Public Function HitTest (x As Integer, y As Integer, requestedElement As ChartElementType) As HitTestResult

Parameters

x
Int32

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

y
Int32

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

requestedElement
ChartElementType

A flag that determines the chart element type to be tested.

Returns

A HitTestResult object that provides information about the chart element, if any, found at the specified location.

Remarks

Call this method to determine if a chart element of the given type is located at a specified point.

Important

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.

HitTest(Int32, Int32)

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

public:
 System::Web::UI::DataVisualization::Charting::HitTestResult ^ HitTest(int x, int y);
public System.Web.UI.DataVisualization.Charting.HitTestResult HitTest (int x, int y);
member this.HitTest : int * int -> System.Web.UI.DataVisualization.Charting.HitTestResult
Public Function HitTest (x As Integer, y As Integer) As HitTestResult

Parameters

x
Int32

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

y
Int32

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

Returns

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

Remarks

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

Important

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.

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:
 System::Web::UI::DataVisualization::Charting::HitTestResult ^ HitTest(int x, int y, bool ignoreTransparent);
public System.Web.UI.DataVisualization.Charting.HitTestResult HitTest (int x, int y, bool ignoreTransparent);
member this.HitTest : int * int * bool -> System.Web.UI.DataVisualization.Charting.HitTestResult
Public Function HitTest (x As Integer, y As Integer, ignoreTransparent As Boolean) As HitTestResult

Parameters

x
Int32

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

y
Int32

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

ignoreTransparent
Boolean

A flag that determines if transparent elements are ignored.

Returns

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

Remarks

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.

Important

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.

Applies to