I'm using CorePlot to draw PieChart. I would like to display labels for slices on slices themselves. Is there a way to get coordinates of each slice and then setting the frame of CPTLayer that holds the text label to adjust to coordinates of the slice?
What I am doing so far:
-(CPRLayer*) datLabelForPlot(CPTPlot*)plot recordIndex:(NSUInteger)index {
static CPTMutableTextStyle *textStyle = nil;
NSString *string = @"Test";
if ( !textStyle) {
textStyle= [[CPTMutableTextStyle alloc] init];
textStyle.color = [CPTColor whiteColor];
}
CPTLayer *layer = [[[CPTLayer alloc] initWithFrame:CGRectMake(50,50, 100, 20)]autorelease];
CPTTextLayer *newLayer = nil;
newLayer = [[[CPTTextLayer alloc] initWithText:string style:textStyle] autorelease];
[layer addSublayer:newLayer];
return layer;
}
but regardless of the layer frame, label is always displayed at the same position (outside the chart). How to set the appropriate layer frame to display the text on the slice itself?
Here is the image of the points I would like to know:


