How to add labels to the pie chart

Thread is closed for posting
5 posts, 0 answers
  1. Froggy
    Froggy avatar
    16 posts
    Member since:
    Apr 2012

    Posted 11 May 2012 Link to this post


    I have the following code to add data to my pie chart in code, but I don't seem to figure out how to set the label for each slice.  I looked at the docs but did not really see how to translate my Dictionary.

    The Dictionary contains <label, value>.  So I just want to use this in the pie chart for data binding.  

                Dictionary<string, int> data = DBHelper.GetTriggerStats();
                int[] result = new int[data.Count()];
                int i = 0;
                foreach (KeyValuePair<string, int> pair in data)
                    result[i] = pair.Value;
               PieSeries series = this.TriggerPieChart.Series[0] as PieSeries;
               series.ItemsSource = result;

    How can I set the label for the pie chart that is in my KeyValuePair as the Key.


  2. Froggy
    Froggy avatar
    16 posts
    Member since:
    Apr 2012

    Posted 16 May 2012 Link to this post

    would appear not to be possible.  Not very helpful.
  3. Victor
    Victor avatar
    1358 posts

    Posted 16 May 2012 Link to this post

    Hi Steven,

    I have answered your question in the other thread you posted on the same topic.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  4. Greg
    Greg avatar
    1 posts
    Member since:
    Jan 2013

    Posted 23 Feb 2015 in reply to Victor Link to this post

    It would have been helpful if you added a link to the other answer
  5. Ves
    Ves avatar
    2926 posts

    Posted 26 Feb 2015 Link to this post

    Hi Greg,

    You can use series label definition as described in this help topic.

    Best regards,

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top