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

PieSeries setLabelValueToStringConverter not called

3 Answers 47 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.
Richard
Top achievements
Rank 1
Richard asked on 12 May 2015, 05:32 PM

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

3 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 15 May 2015, 11:49 AM
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
0
Takudzwa
Top achievements
Rank 1
answered on 10 Oct 2016, 02:31 PM
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
0
Victor
Telerik team
answered on 11 Oct 2016, 03:35 PM
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
Tags
Chart
Asked by
Richard
Top achievements
Rank 1
Answers by
Victor
Telerik team
Takudzwa
Top achievements
Rank 1
Share this question
or