Pie Chart question

2 posts, 0 answers
  1. Quyen
    Quyen avatar
    9 posts
    Member since:
    Dec 2007

    Posted 21 Dec 2007 Link to this post

    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
  2. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 27 Dec 2007 Link to this post

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