Skip to content

Added new kb article detect-datapoint-click-radchartview-winforms #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions knowledge-base/detect-datapoint-click-radchartview-winforms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: How to detect DataPoint of RadBarSeries on Click in RadChartView
description: Learn how to detect the underlying datapoint of a RadBarSeries when clicking on a specific bar in RadChartView.
type: how-to
page_title: How to Detect DataPoint on Click in RadChartView for WinForms
meta_title: How to Detect DataPoint on Click in RadChartView for WinForms
slug: chartview-get-datapoint-mouse-click
tags: radchartview, winforms, radbarseries, datapoint, mouseclick, hit-test
res_type: kb
ticketid: 1691155
---

## Environment

|Product Version|Product|Author|
|----|----|----|
|2025.2.520|RadChartView for WinForms|[Nadya Todorova](https://www.telerik.com/blogs/author/nadya-karaivanova)|

## 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

- [RadChartView Documentation](https://docs.telerik.com/devtools/winforms/controls/chartview/overview)
- [BarSeries](https://docs.telerik.com/devtools/winforms/controls/chartview/series-types/bar)