Create chart click event

Thread is closed for posting
6 posts, 0 answers
  1. Martin
    Martin avatar
    8 posts
    Member since:
    Oct 2008

    Posted 05 Feb 2009 Link to this post

    I have written code to programmatically create a chart object and add one or more chart series to it.  This method is being called from an asp.net page and it returns the chart object.  The chart is being added to the page using the Controls.Add method.  After adding the chart, the series are not clickable.  How do I make the series (bar chart bars) clickable and hook them to event code in the page?
  2. Ves
    Admin
    Ves avatar
    2927 posts

    Posted 06 Feb 2009 Link to this post

    Hi Martin,

    All you need to do is wire the Click event. You can find more details in these help topics - here and here, and this online example.

    Regards,
    Ves
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Martin
    Martin avatar
    8 posts
    Member since:
    Oct 2008

    Posted 06 Feb 2009 Link to this post

    This does not appear to work.  I wired the click event as shown: 

    radChart1.ChartTitle.ActiveRegion.Click +=
           new RegionClickEventHandler(chartControl_Click);

    The chartControl_Click method exists in the code.

    The assignment of the event handler generates the following error:  

    Error 1 No overload for 'chartControl_Click' matches delegate 'Telerik.Charting.RegionClickEventHandler' C:\depot\rsAnalytics\main\src\ResourceScheduler.Analytics\Default.aspx.cs 70 63 Analytics

    I am using the latest version of the Telerik RadControls for ASP.Net Ajax
  4. Ves
    Admin
    Ves avatar
    2927 posts

    Posted 09 Feb 2009 Link to this post

    Hi Martin,

    It seems, there is a mistake in the help topic I pointed. You can find below the event handler signatures for RadChart.Click and for ActiveRegion.Click events:

    void RadChart1_Click(object sender, ChartClickEventArgs args)

    void ActiveRegion_Click(object sender, RegionClickEventArgs args)

    Hope this helps.

    Greetings,
    Ves
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Quantesys IT
    Quantesys IT avatar
    21 posts
    Member since:
    Feb 2009

    Posted 26 Oct 2009 Link to this post

    Hello,
    I am trying to implement a special behaviour when a click is made on an activeRegion of my RadChart. Here is my code:

    protected void rcChart_BeforeLayout(object sender, EventArgs e)     
        {     
                foreach (ChartSeriesItem item in rcChart.Series[0].Items)     
                {     
                    

                    item.ActiveRegion.Tooltip = "Test";

                    item.ActiveRegion.Click += new RegionClickEventHandler(ActiveRegion_Click);     
                }  
        }    
     

    My problem is that the method "ActiveRegion_Click" is never started and I don't understand what I am doing wrong.

    Thank you for your help.

    Joël
  6. Quantesys IT
    Quantesys IT avatar
    21 posts
    Member since:
    Feb 2009

    Posted 29 Oct 2009 Link to this post

    I don't understand why the ActiveRegion_Click event doesn't fired as expected but I solved my problem by using the Chart_Click event...
Back to Top