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

How to add labels to the pie chart

4 Answers 87 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Froggy
Top achievements
Rank 2
Froggy asked on 11 May 2012, 09:33 AM
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.

4 Answers, 1 is accepted

Sort by
0
Froggy
Top achievements
Rank 2
answered on 16 May 2012, 08:11 AM
would appear not to be possible.  Not very helpful.
0
Victor
Telerik team
answered on 16 May 2012, 09:56 AM
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 >>

0
Greg
Top achievements
Rank 1
answered on 23 Feb 2015, 10:18 AM
It would have been helpful if you added a link to the other answer
0
Ves
Telerik team
answered on 26 Feb 2015, 07:42 AM
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.

 
Tags
Chart
Asked by
Froggy
Top achievements
Rank 2
Answers by
Froggy
Top achievements
Rank 2
Victor
Telerik team
Greg
Top achievements
Rank 1
Ves
Telerik team
Share this question
or