how to rotate label of a bar chart and add offset in core plot?
just wondering if there is a way to rotate the labels placed on bar charts and add offset to it ? Thank you.
Below my delegate implementation. Note the padding on label
-(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index
{
CPTMutableTextStyle *whiteTextStyle = [[[CPTMutableTextStyle alloc] init] autorelease];
whiteTextStyle.color = [CPTColor whiteColor];
whiteTextStyle.fontSize = 14.0f;
CPTTextLayer *label = [[CPTTextLayer alloc] 开发者_C百科initWithText:@"Test" style:whiteTextStyle];
label.paddingLeft = -100.0f; // <---
return [label autorelease];
}
Use the labelOffset
and labelRotation
properties on the plot. These are inherited from CPTPlot
by all Core Plot plots.
You should not set the padding in -dataLabelForPlot:recordIndex:
.
精彩评论