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

PieChart Labels / Legend

12 Answers 272 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 2
Brian asked on 24 Nov 2014, 05:58 PM
I need to specify labels for my PieChart.  As of right now it seems this is not possible.

Would it be possible to create a legend from the rendered chart if we cannot set a specific label?

12 Answers, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 27 Nov 2014, 06:01 PM
Hi Brian,

Thank you for contacting us.

This could be achieved with a ListView control that is data bound to the same collection as the ItemsSource of the PieSeries. You will have to set a custom ListView.ItemTemplate that contains color and information for the corresponding data point. If you create a custom chart palette you will be able to get the right color for a data item depending on its index in the collection.

Unfortunately, at this moment there is a bug with the RadPieChart and the palettes are not applied properly to the series. We will look into this issue and will get back to you as soon as we have a solution.

I have attached a sample project that demonstrates how this it could work, but please note that only the pie chart in the Windows Phone project renders correctly.

I hope this helps.

Regards,
Rosy Topchiyska
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.

 
0
Goh
Top achievements
Rank 1
answered on 17 Apr 2015, 03:53 AM
Hi, may i know what is the status to specify labels in Pie Chart? it is workable now in Xamarin.Forms?
0
Goh
Top achievements
Rank 1
answered on 17 Apr 2015, 03:54 AM
Hi, may i know what is the status to specify labels in Pie Chart? it is workable now in Xamarin.Forms?
0
Ves
Telerik team
answered on 21 Apr 2015, 10:59 AM
Hi Goh,

You can display labels by setting the ShowLabels property of PieSeries to true.

Best regards,
Ves
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Jeremias
Top achievements
Rank 1
answered on 10 Dec 2015, 11:40 PM
Hi, I'm having an issue in Android, when I set the palette, the colors are displayed correctly, but the labels are not visible.. Is this still an issue with the chart??
0
Jeremias
Top achievements
Rank 1
answered on 10 Dec 2015, 11:41 PM
additional information, I'm developing in Xamarin Studio, a Xamarin Forms solutions
0
Ves
Telerik team
answered on 15 Dec 2015, 04:56 PM
Hi Jeremias,

The labels use the StrokeColor of the PaletteEntry, so when creating custom palette, please specify both FillColor and StrokeColor:

var palette = new ChartPalette();
 
palette.Entries.Add(new PaletteEntry(Color.Blue, Color.Black));
palette.Entries.Add(new PaletteEntry(Color.Gray, Color.Black));


Best regards,
Ves
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jeremias
Top achievements
Rank 1
answered on 15 Dec 2015, 11:55 PM
Excellent, Thanks
0
Ian
Top achievements
Rank 1
answered on 03 Nov 2016, 03:03 PM
Setting the <em>ShowLabels</em> property of PieSeries to true does work but how can I choose to bind the displayed value in the pie sector to some other part of my model other than the numeric variable I've used to define the slice size in my datamodel ?
0
Ves
Telerik team
answered on 07 Nov 2016, 09:49 AM
Hi Ian,

You can take advantage of LabelBinding and LabelFormat properties. The former works just like ValueBinding, retrieving a property you specify from the underlying object and showing it as a label, and the latter serves to accept a format, should you want to display a numeric or date/time value

Best regards,
Ves
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ian
Top achievements
Rank 1
answered on 08 Nov 2016, 09:09 AM

Many thanks for info on LabelBinding.

Have you a specific example of the user of LabelFormat , i.e where to place it in the XAML and example formatting syntax.

I tried something like "{0}%" and it broke the XAML.

0
Ves
Telerik team
answered on 10 Nov 2016, 03:33 PM
Hi Ian,

Curly braces in XAML must be preceded by a pair of open-close curly braces i.e. your label format should look like this: {}{0}% In addition, you can apply formatting this way: {}{0:F2}% - this will display values with 2 decimals e.g. 17.00%.
Note, that this will only add percent character after the label, but it will not calculate the actual percentage. You will need to calculate the percentage by yourself and store it in a property to use as a label.

Best regards,
Ves
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Brian
Top achievements
Rank 2
Answers by
Rosy Topchiyska
Telerik team
Goh
Top achievements
Rank 1
Ves
Telerik team
Jeremias
Top achievements
Rank 1
Ian
Top achievements
Rank 1
Share this question
or