このグラフに似た円グラフを描かなければなりません。画像(実際のカウントとパーセント値)に記載されているように、テキストを含むデータラベルを2行で表示する必要がありますコアプロットを使用してこれが可能かどうかを知りたい. 以下のデリゲートを使用してパーセントまたは実際のカウントを取得していますが、両方の値を取得する方法がわかりません。どんな助けでも大歓迎です。
-(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index {
if([plot isKindOfClass:[CPTPieChart class]]) {
static CPTMutableTextStyle *labelText = nil;
if (!labelText) {
labelText= [[CPTMutableTextStyle alloc] init];
labelText.color = [CPTColor blueColor];
}
NSDecimalNumber *portfolioSum = [NSDecimalNumber zero];
for (NSDecimalNumber *price in [[CPDStockPriceStore sharedInstance] dailyPortfolioPrices]) {
portfolioSum = [portfolioSum decimalNumberByAdding:price];
}
NSDecimalNumber *countValue = [[[CPDStockPriceStore sharedInstance] dailyPortfolioPrices] objectAtIndex:index];
NSString *labelValue = [NSString stringWithFormat:@"%@",countValue];
CPTTextLayer *textLayer = [[CPTTextLayer alloc]initWithText:labelValue];
return textLayer;
}
else {
return nil;
}
}