How to: Show Series Labels Only for Hot-tracked Points

  • 2 minutes to read

This example demonstrates how to make a chart show a series point label only for the point that has been hot-tracked.

To do this, in the ChartControl.CustomDrawSeriesPoint event handler, assign an empty string to the CustomDrawSeriesPointEventArgs.LabelText property of each series point, and then assign the point's value to the hot-tracked point, which is obtained in the ChartControl.ObjectHotTracked event handler.

using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...
        SeriesPoint m_HotTrackedPoint;

        void chartControl1_ObjectHotTracked(object sender, HotTrackEventArgs e)
            SeriesPoint point = e.AdditionalObject as SeriesPoint;
            if (!Object.ReferenceEquals(point, m_HotTrackedPoint))
                m_HotTrackedPoint = point;

        void chartControl1_CustomDrawSeriesPoint(object sender, CustomDrawSeriesPointEventArgs e)

            if (!Object.Equals(e.SeriesPoint, m_HotTrackedPoint))
                e.LabelText = "";

The result is shown in the following image.


See Also