How can I detect which dataItem user has clicked

2 posts, 0 answers
  1. shobha
    shobha avatar
    1 posts
    Member since:
    Oct 2008

    Posted 07 Oct 2008 Link to this post

    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' 

     

  2. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 08 Oct 2008 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top