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

Customise Donut Chart Label with percentage

1 Answer 70 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.
Ranganathan
Top achievements
Rank 1
Ranganathan asked on 07 Mar 2017, 12:06 PM

Hi, 

I need to customise the Label displayed in Donut Chart. I have set TKChart.Delegate to TKChartDelegate but the method TextForLabelAtPoint is not being called.

Am I missing anything? I tried using the sample downloaded from your package. It displays only the value 20, 30, etc but I not able to customise the Label.

 

Please provide some sample code or point to some documentation.

Thanks

1 Answer, 1 is accepted

Sort by
0
Miroslava
Telerik team
answered on 09 Mar 2017, 01:36 PM
Hello Ranganathan,

Thank you for contacting us.
You can customize the label with a percentage by setting the StringFormat property of PointLabelStyle.

series.style.pointLabelStyle.stringFormat = @"%.0f%%";


You can customize the point label text by handling chart:labelForDataPoint:property:inSeries:atIndex: method of TKChartDelegate:

- (TKChartPointLabel *)chart:(TKChart *)chart labelForDataPoint:(id<TKChartData>)dataPoint property:(NSString *)propertyName inSeries:(TKChartSeries *)series atIndex:(NSUInteger)dataIndex

{

    TKChartPointLabel *label = [[TKChartPointLabel alloc] initWithPoint:dataPoint series:series text:@"my label text"];

    return label;

}


I hope this helps. If you need further assistance, I will be glad to help.


Regards,
Miroslava
Telerik by Progress
Want to build beautiful Android apps as well? Check out UI for Android which enables the same set of scenarios, allowing you to create the same great app experience on both iOS and Android.
Tags
Chart
Asked by
Ranganathan
Top achievements
Rank 1
Answers by
Miroslava
Telerik team
Share this question
or