开发者

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:.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜