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

pie chart colours

1 Answer 63 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.
David A
Top achievements
Rank 1
David A asked on 18 Nov 2014, 12:26 PM
How do I change the colours of the pie chart?

1 Answer, 1 is accepted

Sort by
0
Adrian
Telerik team
answered on 18 Nov 2014, 03:24 PM
Hi David,

Thank you for contacting us.

To change the colors of the pie slices, you should use TKChartDelegate's chart:paletteItemForSeries:atIndex: method to return a palette item that suits your needs. The following code snippet will change the color of the slice at index 3 to yellow:
- (TKChartPaletteItem *)chart:(TKChart *)chart paletteItemForSeries:(TKChartSeries *)series atIndex:(NSUInteger)index
{
    if (index == 3) {
        TKChartPaletteItem *item = [[TKChartPaletteItem alloc] initWithFill:[TKSolidFill solidFillWithColor:[UIColor yellowColor]]];
        return item;
    }
 
     
    return nil;
}

Do not forget to set TKChart's delegate:
_chart.delegate = self;

More info about custom drawing in TKChart you can find in out documentation.

I hope this helps. I will be glad to assist you if you need any help.

Regards,
Adrian
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.

 
Tags
Chart
Asked by
David A
Top achievements
Rank 1
Answers by
Adrian
Telerik team
Share this question
or