0
iOS에서 CorePlot을 사용하여 그래프를 표시하고 있는데, y 축 사용자 정의 레이블을 표시 할 수 있지만 X 축 사용자 정의 레이블을 볼 수 없습니다. 여기iOS 코어 플롯 X 축 레이블이 보이지 않습니다.
내가이 X 축 맞춤 라벨을 표시하기위한 사용하고 코드입니다 ..
// 2 - Get axis set
CPTXYAxisSet *axisSet = (CPTXYAxisSet *) self.hostView.hostedGraph.axisSet;
// 3 - Configure x-axis
CPTAxis *x = axisSet.xAxis;
x.titleTextStyle = axisTitleStyle;
x.titleOffset = 0.0f;
x.axisLineStyle = axisLineStyle;
x.labelingPolicy = CPTAxisLabelingPolicyNone;
x.labelTextStyle = axisTextStyle;
x.majorTickLineStyle = axisLineStyle;
x.majorTickLength = 4.0f;
x.minorTickLength = 0.0f;
x.tickDirection = CPTSignNegative;
// Draw labels
NSArray *xCustomTickLocations = [NSArray arrayWithObjects:[NSDecimalNumber numberWithInt:1], [NSDecimalNumber numberWithInt:2],[NSDecimalNumber numberWithInt:3],[NSDecimalNumber numberWithInt:4],[NSDecimalNumber numberWithInt:5],[NSDecimalNumber numberWithInt:6],[NSDecimalNumber numberWithInt:7] ,nil];
NSArray *xAxisLabels = [NSArray arrayWithObjects:@"A", @"B", @"C", @"D", @"E",@"F",@"G", nil];
NSUInteger labelLocation = 0;
NSMutableArray *xCustomLabels = [NSMutableArray arrayWithCapacity:[xAxisLabels count]];
for (NSNumber *tickLocation in xCustomTickLocations) {
CPTAxisLabel *newLabel = [[CPTAxisLabel alloc] initWithText: [xAxisLabels objectAtIndex:labelLocation++] textStyle:x.labelTextStyle];
newLabel.tickLocation = [tickLocation decimalValue];
[xCustomLabels addObject:newLabel];
}
x.axisLabels = [NSSet setWithArray:xCustomLabels];
x.majorTickLocations = [NSSet setWithArray:xCustomTickLocations];
내가 뭘 잘못에서 저를 도와주세요. 눈금은 표시되지만 레이블은 표시되지 않습니다.