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

Create chart click event

5 Answers 274 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 05 Feb 2009, 04:21 PM
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?

5 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 06 Feb 2009, 08:26 AM
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.
0
Martin
Top achievements
Rank 1
answered on 06 Feb 2009, 04:12 PM
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
0
Ves
Telerik team
answered on 09 Feb 2009, 09:02 AM
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.
0
Quantesys IT
Top achievements
Rank 1
answered on 26 Oct 2009, 04:43 PM
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
0
Quantesys IT
Top achievements
Rank 1
answered on 29 Oct 2009, 07:46 AM
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...
Tags
Chart (Obsolete)
Asked by
Martin
Top achievements
Rank 1
Answers by
Ves
Telerik team
Martin
Top achievements
Rank 1
Quantesys IT
Top achievements
Rank 1
Share this question
or