MindFusion.Charting Programmer's Guide

Chart.HitTest Method

See Also
 





Checks whether a point with the particular coordinates is contained inside a chart element.

Namespace: MindFusion.Charting
Assembly: MindFusion.Charting

 Syntax

C#  Copy Code

public virtual ChartElement HitTest (
    int x,
    int y
)

Visual Basic  Copy Code

Public Overridable Function HitTest ( _
    x As Integer, _
    y As Integer _
) As ChartElement

JavaScript  Copy Code

function HitTest (x, y)

 Parameters

x
The X-coordinate of the point to check.
y

The Y-coordinate of the point to check.

 Return Value

An object of type ChartElement that contains the point described by the two parameters of the function; null if no object is found.

 Remarks

Call this method inside event handlers for user interaction with the mouse. The mouse coordinates are retrieved from the event data.

The Chart control overrides HitTest to return a specific chart element. Cast the result to Bar, Line, Scatter, Bubble, PiePiece or RadarPiece according to the chart type you are using. All HitTest methods may return null so always check.

 See Also