We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Different mouse events for each chart collumn?

Thread ID:





73567 May 12,2008 12:51 AM UTC May 12,2008 04:43 AM UTC WPF 1
Tags: Chart
Administrator [Syncfusion]
Asked On May 12, 2008 12:51 AM UTC

I need to click on a collumn, in a bar chart, and get a specific event. I know its possible to launch an event when cliking a series on the chart. My problem is, i need to get a different result for each collumn, and the event seems to be relative to the whole series.

Is there any way to do this, or at least to know in which collumn i have clicked?

It's really important for me to get this done, any help would be very appreciated.

Administrator [Syncfusion]
Replied On May 12, 2008 04:43 AM UTC

Hi Tiago,

Thanks for your interest in Syncfusion products. ChartSeries click event does not return the column on which it was clicked, but using the MouseEventArgs of the event we can get the column of the chartseries.

The following lines of code can be used to get the chart point on which click was made.

C# Code:

Point pt = e.GetPosition((UIElement)sender);

//get the x axis value based on the clicked co - ordinates
double Xvalue = area.PointToValue(area.PrimaryAxis, pt);

//get the Y axis value based on the clicked co - ordinates
double Yvalue = area.PointToValue(area.SecondaryAxis, pt);

The following lines of code can be used to get the column on which click was made.

C# Code:

void ChartSeries1_Click(object sender, MouseEventArgs e)
ChartSeries series = (ChartSeries)sender;
HitTestResult hr = VisualTreeHelper.HitTest(this, e.GetPosition((UIElement)chart1.Areas[0]));


By using the VisualHit property of the HitTestResult, each chart column of the chart can be obtained.

Let me know if you have any queries.

Thanks for your interests Syncfusion products.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon