PieSeries setLabelValueToStringConverter not called

4 posts, 0 answers
  1. Richard
    Richard avatar
    44 posts
    Member since:
    Jun 2014

    Posted 12 May 2015 Link to this post

    I am trying to figure out how to change the labels on my pie chart and there is no way to add a category binding to a pie chart so I tried overiding the setLabelValueToStringConverter() method but it is never called.

     

    How do you change the label on a pie chart?

     

    Rich

  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 15 May 2015 Link to this post

    Hello Richard,

    Thanks for reporting this.
    This is a bug, the PieSeries currently ignore the converter. I have fixed this and the updated version will be available for download shortly.

    At the moment you have to inherit from PieSeriesLabelRenderer. For example:
    public class CustomLabelRenderer extends PieSeriesLabelRenderer {
        public CustomLabelRenderer(PieSeries owner) {
            super(owner);
        }
        @Override
        protected String getLabelText(DataPoint dataPoint) {
            PieDataPoint piePoint = (PieDataPoint)dataPoint;
            double pieValue = piePoint.getValue();
            // Create label text here
            return Double.toString(pieValue);
            // or return the result of the base implementation.
            // return super.getLabelText(dataPoint);
        }
    }

    Then you use it like this:
    pieSeries.setLabelRenderer(new CustomLabelRenderer(pieSeries));

    Please write again if you need further assistance.

    Regards,
    Victor
    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
  3. DevCraft banner
  4. Takudzwa
    Takudzwa avatar
    4 posts
    Member since:
    Oct 2014

    Posted 10 Oct in reply to Victor Link to this post

    Hi, can i have the C# version of the above snippet for creating custom label renderer. I want to implement the same concept in Xamarin.Android
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 11 Oct Link to this post

    Hi Takudzwa,

    Thanks for writing.
    I answered your question in one of the other threads your posted.

    Regards,
    Victor
    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