【发布时间】:2011-05-18 11:25:58
【问题描述】:
我正在使用核心图绘制饼图和以下文本
错误 10
通过 400
所以对于上述数据,我的饼图包含 2 个具有 2 种不同颜色的切片
我想为每个切片设置相同的文本颜色
现在文字是白色的
谢谢你
【问题讨论】:
标签: iphone objective-c graph colors core-plot
我正在使用核心图绘制饼图和以下文本
错误 10
通过 400
所以对于上述数据,我的饼图包含 2 个具有 2 种不同颜色的切片
我想为每个切片设置相同的文本颜色
现在文字是白色的
谢谢你
【问题讨论】:
标签: iphone objective-c graph colors core-plot
@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];
}
【讨论】:
您可以使用绘图的labelTextStyle 属性来更改标签的外观。
【讨论】:
-sliceFillForPieChart:recordIndex: 和-sliceLabelForPieChart:recordIndex: 方法。对切片标签中使用的填充和文本样式使用相同的颜色。