PieChart Labels / Legend

13 posts, 0 answers
  1. Brian
    Brian avatar
    35 posts
    Member since:
    Dec 2007

    Posted 24 Nov 2014 Link to this post

    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?

  2. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    550 posts

    Posted 27 Nov 2014 Link to this post

    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.

     
  3. DevCraft banner
  4. Goh
    Goh avatar
    3 posts
    Member since:
    Dec 2012

    Posted 16 Apr 2015 Link to this post

    Hi, may i know what is the status to specify labels in Pie Chart? it is workable now in Xamarin.Forms?
  5. Goh
    Goh avatar
    3 posts
    Member since:
    Dec 2012

    Posted 16 Apr 2015 in reply to Rosy Topchiyska Link to this post

    Hi, may i know what is the status to specify labels in Pie Chart? it is workable now in Xamarin.Forms?
  6. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 21 Apr 2015 Link to this post

    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.

     
  7. Jeremias
    Jeremias avatar
    3 posts
    Member since:
    Dec 2011

    Posted 10 Dec 2015 in reply to Ves Link to this post

    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??
  8. Jeremias
    Jeremias avatar
    3 posts
    Member since:
    Dec 2011

    Posted 10 Dec 2015 in reply to Jeremias Link to this post

    additional information, I'm developing in Xamarin Studio, a Xamarin Forms solutions
  9. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 15 Dec 2015 Link to this post

    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
  10. Jeremias
    Jeremias avatar
    3 posts
    Member since:
    Dec 2011

    Posted 15 Dec 2015 in reply to Ves Link to this post

    Excellent, Thanks
  11. Ian
    Ian avatar
    3 posts
    Member since:
    Oct 2016

    Posted 03 Nov Link to this post

    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 ?
  12. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 07 Nov Link to this post

    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
  13. Ian
    Ian avatar
    3 posts
    Member since:
    Oct 2016

    Posted 08 Nov Link to this post

    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.

  14. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 10 Nov Link to this post

    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
Back to Top
DevCraft banner