【发布时间】:2015-08-25 14:42:10
【问题描述】:
我在 iOS 上使用 CorePlot,我喜欢这个图表示例,但我无法在我的图表上做同样的事情。
您能否建议我在我的图表中添加什么代码以便在三角形内添加标签?我试过的代码如下:
-(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index
{
NSNumber * dataForItem = [self.dataForChart objectAtIndex:index];
if ( [plot isKindOfClass:[CPTPieChart class]]){
return [[CPTTextLayer alloc] initWithText:[NSString stringWithFormat:@"%@", dataForItem]];
}
else return nil;
}
但是我得到的结果有不在三角形中的标签:
我实现了dataLabel
【问题讨论】:
标签: ios graph customization core-plot labels