显示与饼图切片相同的文本标签颜色

时间:2011-05-18 11:25:59

标签: iphone objective-c graph colors core-plot

我正在使用核心情节来绘制饼图和以下文字

错误10
通过400

因此,对于上述数据,我的饼图包含2个不同颜色的切片

我想为每个切片设置相同的文字颜色

现在文字为白色

谢谢

2 个答案:

答案 0 :(得分:2)

@pooja我明白了:)试试这个而不实施

-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];
}

答案 1 :(得分:1)

您可以使用绘图的labelTextStyle属性来更改标签的外观。

相关问题