New to Telerik UI for WinFormsStart a free 30-day trial

How to detect DataPoint of RadBarSeries on Mouse Click in RadChartView

Updated over 6 months ago

Environment

Product VersionProductAuthor
2025.2.520RadChartView for WinFormsNadya Todorova

Description

This article shows how to identify a datapoint of a RadBarSeries in RadChartView when clicking on a specific bar.

Solution

To achieve this, handle the MouseClick event of RadChartView and use the HitTest method to detect the datapoint associated with the clicked bar. Here is the code example:

C#

this.radChartView1.MouseClick += RadChartView1_MouseClick;

private void RadChartView1_MouseClick(object sender, MouseEventArgs e)
{
    foreach (var s in this.radChartView1.Series)
    {
        Telerik.WinControls.UI.BarSeries barSeries = s as Telerik.WinControls.UI.BarSeries;
        if (barSeries != null)
        {
            DataPoint dp = barSeries.HitTest(e.Location.X, e.Location.Y);
            if (dp != null)
            {
                Console.WriteLine(dp.Label); // Outputs the datapoint label
            }
        }
    }
}

See Also