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.
Unfortunately, activation email could not send to your email. Please try again.

Different mouse events for each chart collumn?

Thread ID:

Created:

Updated:

Platform:

Replies:

73567 May 11,2008 08:51 PM May 12,2008 12:43 AM WPF 1
loading
Tags: Chart
Administrator [Syncfusion]
Asked On May 11, 2008 08:51 PM

Hi,
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.
Thanks.


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

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.

Regards,
Athaur




CONFIRMATION

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.

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.

;