Core plot 如何将Core Plot X标签移动到刻度之间?
如何将X轴标签的文本向右(水平)移动? 我希望能够显示两个x记号(例如,|Jan | Feb |……)之间的字符串,而不是默认情况下跨在x记号上的字符串 我尝试了以下方法:Core plot 如何将Core Plot X标签移动到刻度之间?,core-plot,Core Plot,如何将X轴标签的文本向右(水平)移动? 我希望能够显示两个x记号(例如,|Jan | Feb |……)之间的字符串,而不是默认情况下跨在x记号上的字符串 我尝试了以下方法: newLabel = [[CPTAxisLabel alloc] initWithText:item.month textStyle:x.labelTextStyle]; newLabel.tickLocation = [[NSDecimalNumber numberWithInt:index] decimalValue];
newLabel = [[CPTAxisLabel alloc] initWithText:item.month textStyle:x.labelTextStyle];
newLabel.tickLocation = [[NSDecimalNumber numberWithInt:index] decimalValue];
CGPoint myPoint = newLabel.contentLayer.position;
CGFloat x = myPoint.x;
CGPoint yourPoint = myPoint;
yourPoint.x += 16.0;
[newLabel positionBetweenViewPoint:myPoint andViewPoint:yourPoint forCoordinate:CPTCoordinateX inDirection:CPTSignPositive];
…但我遇到了一个SIGABRT错误(崩溃)。一个例子胜过千言万语 问候,,
Ric现在没有一个简单的方法可以做到这一点。您需要使用自定义标签。将轴标记策略设置为
cptaxislabelingpolicyne
,并设置所需的标记位置和标签。有关一些示例代码,请参见Plot Gallery应用程序中的