A newer version of this page is available. Switch to the current version.

Hit Information

  • 6 minutes to read

The Chart control can process hit information to identify a chart element at the specified screen coordinates. This allows you to provide custom actions when an end user clicks or hovers the mouse pointer over a specific element. You can handle a control's mouse events to obtain the mouse pointer's coordinates, for example, ChartControl.MouseMove or ChartControl.Click. To obtain hit information about the test point with these coordinates, use the ChartControl.CalcHitInfo method.


The document consists of the following sections:


Enable the ChartControl.RuntimeHitTesting property to allow a chart to collect and process hit information.

Design time

Expand the Chart Control's Behavior properties' group in the Properties window. Then, select True in the RuntimeHitTesting property's drop-down list.



Enable RuntimeHitTesting at runtime on during a chart's initialization, for example, in the Form's constructor after the components' initialization or in the Form's Load event handler.

private void Form_Load(object sender, EventArgs e) {
    chartControl.RuntimeHitTesting = true;

When RuntimeHitTesting is enabled, the Chart Control requires more memory resources, and its performance can decrease. Refer to Performance for more information.


The Chart control collects information about the hit-tested points regardless of whether RuntimeHitTesting is enabled when you handle the ChartControl.ObjectHotTracked or ChartControl.ObjectSelected events, or Selection is enabled using the ChartControl.SelectionMode property.

To hit-test series points, make sure that a series view's markers are visible. To make them visible, specify the series view's MarkerVisibility property to true. For example, set the LineSeriesView.MarkerVisibility property to true to show a line series view's markers.

Use the ChartControl.CalcHitInfo method to obtain information about a point in a chart. The method returns a ChartHitInfo object that uses the following properties to store the hit information:

How to: Determine a Chart Element in a Test Point

The following example shows how to obtain information about the chart element under the mouse pointer and use the ToolTipController Componentto display this information.

ToolTipController toolTipController = new ToolTipController();
private void chartControl_MouseMove(object sender, MouseEventArgs e) {
    ChartHitInfo hitInfo = chartControl.CalcHitInfo(e.Location);
    StringBuilder builder = new StringBuilder();
        builder.AppendLine("In diagram");
        builder.AppendLine("In non-default pane: " + hitInfo.NonDefaultPane.Name);
    if(hitInfo.InAxis) {
        builder.AppendLine("In axis: " + hitInfo.Axis.Name);
        if(hitInfo.AxisLabelItem != null)
            builder.AppendLine("  Label item: " + hitInfo.AxisLabelItem.Text);
        if(hitInfo.AxisTitle != null)
            builder.AppendLine("  Axis title: " + hitInfo.AxisTitle.Text);
        builder.AppendLine("In chart title: " + hitInfo.ChartTitle.Text);
    if(hitInfo.InLegend) {
        builder.AppendLine("In legend");
        if(hitInfo.Series != null && !hitInfo.InSeries)
            builder.AppendLine("  Series: " + ((Series)hitInfo.Series).Name);
        builder.AppendLine("In series: " + ((Series)hitInfo.Series).Name);
    if(hitInfo.InSeriesLabel) {
        builder.AppendLine("In series label");
        builder.AppendLine("  Series: " + ((Series)hitInfo.Series).Name);
    if(hitInfo.InSeriesPoint) {
        builder.AppendLine("  Argument: " + hitInfo.SeriesPoint.Argument);
            builder.AppendLine("  Value: " + hitInfo.SeriesPoint.Values[0]);
        if(hitInfo.Annotation is TextAnnotation)
            builder.AppendLine("In annotation: " + ((TextAnnotation)hitInfo.Annotation).Name);
        else if(hitInfo.Annotation is ImageAnnotation)
            builder.AppendLine("In annotation: " + ((ImageAnnotation)hitInfo.Annotation).Name);
    if(builder.Length > 0)
        toolTipController.ShowHint("Hit-testing results:\n" + builder.ToString(), chartControl.PointToScreen(e.Location));
void chart_MouseLeave(object sender, EventArgs e) {
Member Description
ChartHitInfo Contains information about a specific point in a chart.
ChartControl.CalcHitInfo Returns information about the chart elements at the specified x and y coordinates.
See Also