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

Pie Chart question

1 Answer 123 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.
Quyen
Top achievements
Rank 1
Quyen asked on 21 Dec 2007, 06:48 PM
Hi All :) ,

is it possible know the region area when the user click on a pie chart ?

For example:

I have a pie chart that displays the number of schedules jobs that that runs on a daily basis;  let say 40 jobs failed and 50 succeed .. I want to know if it is possible
to know if the users clicks on Failures region it will fires an event  to drill down a grid and show the details of these jobs?


Thanks In Advance

1 Answer, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 27 Dec 2007, 01:13 PM
Hi Quyen,

Thank you for contacting us. The click event of the RadChart exposes the following information through the ChartClickEventArgs:
  • SeriesItem - the item that have been clicked.
  • Series - the series to which the item belongs.
Here is a short example demonstrating the functionality would like to implement:

        public Form3()  
        {  
            InitializeComponent();  
 
            //hook up the event handler  
            radChart1.Click += new Telerik.WinControls.UI.RadChart.ChartClickEventHandler(this.radChart1_Click);  
              
            radChart1.Series.Clear();  
              
            //create series  
            radChart1.CreateSeries("Outcomes", Color.Black, Color.Black, ChartSeriesType.Pie);  
              
            //add items  
            ChartSeriesItem csi = new ChartSeriesItem();  
            csi.Name = "Successes";  
            csi.YValue = 55;  
            radChart1.Series[0].Items.Add(csi);  
 
            ChartSeriesItem csi1 = new ChartSeriesItem();  
            csi1.Name = "Failures";  
            csi1.YValue = 5;  
            radChart1.Series[0].Items.Add(csi1);  
            //refresh the chart  
            radChart1.UpdateGraphics();  
        }  
 
        private void radChart1_Click(object sender, ChartClickEventArgs args)  
        {  
            if (args.Element.ActiveRegion.Parent is ChartSeriesItem)  
            {  
                MessageBox.Show((args.Element.ActiveRegion.Parent as ChartSeriesItem).Name + " pie sector clicked");  
                if ((args.Element.ActiveRegion.Parent as ChartSeriesItem).Name.Equals("Failures"))  
                {  
                    MessageBox.Show("Place custom code to show failures here");  
                }  
            }  
        } 

Please, let us know if that helps. If you have further questions, do not hesitate to ask.

All the best,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Chart (obsolete as of Q1 2013)
Asked by
Quyen
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Share this question
or