0
내 앱에 분산 형 플롯을 추가하고 있으며 배열에 포함 된 항목 인 X 축 레이블에 cogsetUsed (예 : 자전거 톱니)를 표시하려고합니다.코어 플롯 : X 축 라벨이 위로 말아 짐
이 코드의 조각이다 : 당신의 도움에 대한
CPTGraph *graph = self.hostView.hostedGraph;
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
CPTXYAxis *x = axisSet.xAxis;
x.visibleRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInteger(0) length:CPTDecimalFromInteger(12)];
x.labelingPolicy = CPTAxisLabelingPolicyNone;
x.labelTextStyle = axisTextStyle;
x.majorTickLineStyle = axisLineStyle;
x.majorTickLength =4.0f;
x.tickDirection =CPTSignNegative;
CGFloat recordCount = [cogsetUsed count];
NSMutableSet *xLabels =[NSMutableSet setWithCapacity:recordCount];
NSMutableSet *xLocations = [NSMutableSet setWithCapacity:recordCount];
NSInteger i =0;
for (NSString *sprocket in cogsetUsed) {
CPTAxisLabel *label = [[CPTAxisLabel alloc] initWithText:sprocket textStyle:x.labelTextStyle];
CGFloat location = i++;
label.tickLocation = CPTDecimalFromCGFloat(location);
label.offset =x.majorTickLength;
if (label) {
[xLabels addObject:label];
[xLocations addObject:[NSNumber numberWithFloat:location]];
}
}
x.axisLabels = xLabels;
x.majorTickLocations = xLocations;
감사 항목의 수는 내가 도착하면 다음과 같다 (11)
8에서 갈 수 있습니다!