Customise Donut Chart Label with percentage

Thread is closed for posting
2 posts, 0 answers
  1. Ranganathan
    Ranganathan avatar
    1 posts
    Member since:
    Mar 2017

    Posted 07 Mar Link to this post

    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

  2. Miroslava
    Admin
    Miroslava avatar
    27 posts

    Posted 09 Mar Link to this post

    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.
Back to Top