Skip to main content
A newer version of this page is available.

DXChartHitInfo Class

Chart hit test result storage.

Namespace: DevExpress.Xamarin.iOS.Charts

Assembly: DevExpress.Xamarin.iOS.Charts.dll

Declaration

public class DXChartHitInfo :
    NSObject

The following members return DXChartHitInfo objects:

Example

The Hit test allows you to determine chart elements located under the specified screen coordinates. For example, the method allows you to know which chart element an end user taps:

public override void TouchesEnded(Foundation.NSSet touches,UIEvent evt) {
    UITouch touch = (UITouch)touches.AnyObject;
    CGPoint location = touch.LocationInView(this.chart);
    DXChartHitInfo hitInfo = this.chart.CalcHitInfo(location);

    bool useComma = false;
    StringBuilder textBuilder = new StringBuilder("You tap");

    if (hitInfo.InSeries) {
        textBuilder.Append(" in a series");
        useComma = true;
    }
    if (hitInfo.InPoint) {
        if (useComma) {
            textBuilder.Append(",");
        }
        textBuilder.Append(" in a point");
        useComma = true;
    }
    if (hitInfo.InLegend) {
        if (useComma) {
            textBuilder.Append(",");
        }
        textBuilder.Append(" in the legend");
    }
    textBuilder.Append(".");

    UIAlertController alertController = UIAlertController.Create(
        title: "Series hit-testing",
        message: textBuilder.ToString(),
        preferredStyle: UIAlertControllerStyle.Alert
    );
    alertController.AddAction(
        UIAlertAction.Create(
            title: "OK",
            style: UIAlertActionStyle.Default,
            handler: null
        )
    );

    this.PresentViewController(
        viewControllerToPresent: alertController,
        animated: true,
        completionHandler: null
    );
}

The following methods and classes allow you to perform hit testing.

Symbols

Description

DXChartBase.CalcHitInfo(CGPoint)

Returns information about chart elements that are under the specified point.

DXChartHitInfo

Chart hit test result storage.

Implements

IEquatable<Foundation.NSObject>
Foundation.INSObjectProtocol
ObjCRuntime.INativeObject

Inheritance

Object
Foundation.NSObject
DXChartHitInfo
See Also