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

DXChartBase.ShowHint(nint, nint) Method

Shows a hint for a series point with the pointIndex of a series with the seriesIndex.

Namespace: DevExpress.Xamarin.iOS.Charts

Assembly: DevExpress.Xamarin.iOS.Charts.dll

Declaration

public virtual void ShowHint(
    nint pointIndex,
    nint seriesIndex
)

Parameters

Name Type Description
pointIndex nint

The zero-based index of a series point for which the Chart should display a hint.

seriesIndex nint

The zero-based index of a series for whose point the Chart should display a hint.

Example

The chart provides methods that show or hide the hint programmatically. The chart delegate allows you to track when a chart shows or hides the hint. For example, the following code shows a hint programmatically and notifies event listeners when end users invoke hints:

class LandAreaChartController: UIChartController {
    public event SelectedLandAreaChangedEventHandler SelectedLandAreaChanged;
    public List<LandAreaItem> LandAreas { get; set; }

    public override void ViewDidLoad() {
        base.ViewDidLoad();
        chart.Delegate = new ChartDelegate(this);
    }

    public void ShowHint(LandAreaItem item) {
        int pointIndex = LandAreas.IndexOf(item);
        if (pointIndex > 0) {
            chart.ShowHint(pointIndex, 0);
        } else {
            chart.HideHint();
        }
    }

    internal RaiseItemChanged(int itemIndex) {
        LandAreaItem item = (itemIndex >= 0) 
            ? LandAreas[itemIndex] 
            : null;
        SelectedLandAreaChangedEventHandler handler = SelectedLandAreaChanged;
        if (handler != null) {
            handler(this, item);
        }
    }
}

class ChartDelegate : DXChartDelegate {
    private LandAreaChartController controller;

    public ChartDelegate(LandAreaChartController controller) {
        this.controller = controller; 
    }

    public void DidShowHint(DXChartBase chart, DXHintInfo hintInfo) {
        NSNumber index = (NSNumber)info.SeriesPointInfos[0].DataPointIndices[0];
        controller.RaiseItemChanged(index.Int32Value);
    }

    public void DidHideHint(DXChartBase chart) {
        controller.RaiseItemChanged(-1);
    }
}

public delegate void SelectedLandAreaChangedEventHandler(object sender, SelectedLandAreaChangedEventArgs args);
public class SelectedLandAreaChangedEventArgs {
    public LandAreaItem SelectedItem { get; }
    public SelectedLandAreaChangedEventArgs(LandAreaItem selectedItem) {
        this.SelectedItem = selectedItem;
    }
}

The table below contains members the chart tooltip API includes.

Member

Description

DXChartBase.ShowHint(CGPoint)

Shows a hint for a series point at the specified screen point.

DXChartBase.ShowHint(nint, nint)

Shows a hint for a series point with the pointIndex of a series with the seriesIndex.

DXChartBase.HideHint()

Hides the hint the chart displays.

DXChartDelegate.DidShowHint(DXChartBase, DXHintInfo)

DXChartDelegate.DidHideHint(DXChartBase)

See Also