How to add labels to the pie chart

5 posts, 0 answers
  1. Froggy
    Froggy avatar
    16 posts
    Member since:
    Apr 2012

    Posted 11 May 2012 Link to this post

    Hi,


    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;
                    i++;
                }
               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.


    Thanks,
    S.

  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. DevCraft banner
  4. Victor
    Admin
    Victor avatar
    1351 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.

    Regards,
    Victor
    the Telerik team

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

  5. 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
  6. Ves
    Admin
    Ves avatar
    2879 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,
    Ves
    Telerik
     

    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
DevCraft banner