我为饼图添加了阴影,但我也为标签数据添加了阴影。我想删除那个阴影。请帮我。 提前谢谢。
piePlot.dataSource = self;
piePlot.pieRadius = 65.0;
piePlot.pieInnerRadius = 35.0;
piePlot.shadowColor = [[UIColor blackColor]CGColor];
piePlot.shadowRadius = 3.0;
piePlot.shadowOffset = CGSizeMake(8,-3);
piePlot.shadowOpacity = 1.0;
piePlot.identifier = @"Current Year Credits By Type";
piePlot.startAngle = M_PI_4;
piePlot.sliceDirection = CPTPieDirectionClockwise;
piePlot.borderLineStyle = [CPTLineStyle lineStyle];
piePlot.sliceLabelOffset = 10.0;
- (CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index {
CPTTextLayer *newLayer = nil;
static CPTMutableTextStyle *whiteText = nil;
if ( !whiteText )
{
whiteText = [[CPTMutableTextStyle alloc] init];
whiteText.color = [CPTColor blackColor];
}
if ( [plot isKindOfClass:[CPTPieChart class]] )
{
NSString *str = [NSString stringWithFormat:@"%@",[pieChartData1 objectAtIndex:index]];
newLayer = [[[CPTTextLayer alloc] initWithText:str style:whiteText] autorelease];
}
return newLayer;
}
答案 0 :(得分:1)
使用Core Plot的CPTShadow
类而不是CALayer
阴影属性。
CPTMutableShadow *blackShadow = [CPTMutableShadow shadow];
blackShadow.shadowOffset = CGSizeMake(8,-3);
blackShadow.shadowColor = [CPTColor blackColor];
piePlot.shadow = blackShadow;