如何使用iPhone sdk中的核心图libraru删除添加到饼图的标签的阴影

发布于 2024-12-11 21:30:46 字数 1147 浏览 0 评论 0原文

我为饼图添加了阴影,但我也为标签数据添加了阴影。我想把那个影子去掉。请帮我。 提前致谢。

            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 *)绘图记录索引:(NSUInteger)索引 {

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;

}

I had added shadow for pie plot but I'm getting shadow for the label data also. I want to remove that shadow. Please help me.
Thanks in advance.

            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;

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彩虹直至黑白 2024-12-18 21:30:46

使用 Core Plot 的 CPTShadow 类而不是 CALayer 阴影属性。

CPTMutableShadow *blackShadow = [CPTMutableShadow shadow];
blackShadow.shadowOffset = CGSizeMake(8,-3);
blackShadow.shadowColor = [CPTColor blackColor];

piePlot.shadow = blackShadow;

Use Core Plot's CPTShadow class instead of the CALayer shadow properties.

CPTMutableShadow *blackShadow = [CPTMutableShadow shadow];
blackShadow.shadowOffset = CGSizeMake(8,-3);
blackShadow.shadowColor = [CPTColor blackColor];

piePlot.shadow = blackShadow;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文