Pooja
Pooja

Reputation: 2200

display same color of text label as pie chart slice have

i am using core plot to draw pie chart and following text

Error 10
Pass 400

so for above data my pie chart contains 2 slice with 2 different color

i want to set the same text color for each slice

right now text is in white color

thank you

Upvotes: 0

Views: 1489

Answers (2)

samar
samar

Reputation: 46

@pooja i got it :) try this without implementing

-sliceFillForPieChart:recordIndex:
-(CPLayer *)dataLabelForPlot:(CPPlot *)plot recordIndex:(NSUInteger)index 
{

CPTextLayer *label = [[CPTextLayer alloc] initWithText:[NSString stringWithFormat:@"%i", index]];
CPMutableTextStyle *textStyle = [label.textStyle mutableCopy];
textStyle.color = [CPPieChart defaultPieSliceColorForIndex:index];
label.textStyle = textStyle;
[textStyle release];
return [label autorelease];
}

Upvotes: 2

Eric Skroch
Eric Skroch

Reputation: 27381

You can use the labelTextStyle property of the plot to change the appearance of the labels.

Upvotes: 1

Related Questions