This is a migrated thread and some comments may be shown as answers.

How can I detect which dataItem user has clicked

1 Answer 72 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
shobha
Top achievements
Rank 1
shobha asked on 07 Oct 2008, 07:21 AM
According to my requirement, whenever the user clicks on particular graph series or hovers,  tool tip should display x-position and y- position at that point.
Code written by me:

foreach

(ChartSeries collection in chart.Series){
foreach (ChartSeriesItem item in collection.Items
{
item.ActiveRegion.Click +=
new RegionClickEventHandler(ActiveRegion_Click);
}
}

 

 

protected void ActiveRegion_Click(object sender)
{
ChartSeriesItem item = (ChartSeriesItem)sender;

 

item.ActiveRegion.Tooltip = item.Parent.Name;

//MessageBox.Show(item.Parent.Name);
}

error:Error 212 No overload for 'ActiveRegion_Click' matches delegate 'Telerik.Charting.RegionClickEventHandler' 

 

1 Answer, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 08 Oct 2008, 07:13 AM
Hello shobha,

I have tested your code and no compile-time errors occur. Please, try to locate the error, or send a sample project, that we can analyze and fix.

Additionally, I suggest handling the RadChart.Click event instead of the RadChartItem.ActiveRegion.Click event. The event arguments provide all the necessary data: Series, SeriesItem, etc. 
Note, that this event is fired in some other cases, so you need to check if SeriesItem and/or Series are not null.

Regards,
Evtim
Tags
Chart (obsolete as of Q1 2013)
Asked by
shobha
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Share this question
or