0

我的核心图有一个奇怪的问题。我有六个 y 轴,它们都有“CPTAxisLabelingPolicyEqualDivisions”政策。该图可以滚动,并且轴上的标签已正确更新。但有时,当我尝试向下滚动图表时,特定轴的最后一个标签会消失。

这是用于创建轴和相对图 plotspace 的代码:

CPTXYAxis *A_Axis = [[CPTXYAxis alloc] init] ;
A_Axis.coordinate                  = CPTCoordinateY;
A_Axis.orthogonalCoordinateDecimal =  CPTDecimalFromCGFloat(_ASpace.yRange.locationDouble);
A_Axis.labelingPolicy              = CPTAxisLabelingPolicyEqualDivisions;
A_Axis.majorGridLineStyle          = majorGridLineStyle;
A_Axis.minorGridLineStyle          = minorGridLineStyle;
A_Axis.preferredNumberOfMajorTicks = MAX_NUMBER_LABEL;
A_Axis.minorTicksPerInterval       = 0;
A_Axis.labelOffset                 = 3.0;
A_Axis.labelPositionY              = 0.0;
labelTextStyle.color = [CPTColor colorWithCGColor:A_Color.CGColor];
A_Axis.tickDirection               = CPTSignNegative;
A_Axis.labelTextStyle = labelTextStyle;
A_Axis.axisConstraints = [CPTConstraints constraintWithRelativeOffset:0.0];
A_Axis.plotSpace = _ASpace;

CPTXYAxis *B_Axis = [[CPTXYAxis alloc] init] ;
B_Axis.coordinate                  = CPTCoordinateY;
B_Axis.orthogonalCoordinateDecimal = CPTDecimalFromCGFloat(_BSpace.yRange.locationDouble);
B_Axis.labelingPolicy              = CPTAxisLabelingPolicyEqualDivisions;
B_Axis.majorGridLineStyle          = majorGridLineStyle;
B_Axis.preferredNumberOfMajorTicks = MAX_NUMBER_LABEL;
B_Axis.minorTicksPerInterval       = 0;
B_Axis.labelOffset                 = 3.0;
B_Axis.labelPositionY              = 11.0;
labelTextStyle.color = [CPTColor colorWithCGColor:B_Color.CGColor];
B_Axis.tickDirection               = CPTSignNegative;
B_Axis.labelTextStyle = labelTextStyle;
B_Axis.axisConstraints = [CPTConstraints constraintWithRelativeOffset:0.0];
B_Axis.plotSpace = _BSpace;

CPTXYAxis *C_Axis = [[CPTXYAxis alloc] init] ;
C_Axis.coordinate                  = CPTCoordinateY;
C_Axis.orthogonalCoordinateDecimal = CPTDecimalFromCGFloat(_CSpace.yRange.locationDouble);
C_Axis.labelingPolicy              = CPTAxisLabelingPolicyEqualDivisions;
C_Axis.majorGridLineStyle          = majorGridLineStyle;
C_Axis.preferredNumberOfMajorTicks = MAX_NUMBER_LABEL;
C_Axis.minorTicksPerInterval       = 0;
C_Axis.labelOffset                 = 3.0;
C_Axis.labelPositionY              = 22.0;
labelTextStyle.color = [CPTColor colorWithCGColor:C_Color.CGColor];
C_Axis.tickDirection               = CPTSignNegative;
C_Axis.labelTextStyle = labelTextStyle;
C_Axis.axisConstraints = [CPTConstraints constraintWithRelativeOffset:0.0];
C_Axis.plotSpace = _CSpace;

CPTXYAxis *D_Axis = [[CPTXYAxis alloc] init] ;
D_Axis.coordinate                  = CPTCoordinateY;
D_Axis.orthogonalCoordinateDecimal = CPTDecimalFromCGFloat(_DSpace.yRange.locationDouble);
D_Axis.labelingPolicy              = CPTAxisLabelingPolicyEqualDivisions;
D_Axis.majorGridLineStyle          = majorGridLineStyle;
D_Axis.minorGridLineStyle          = minorGridLineStyle;
D_Axis.preferredNumberOfMajorTicks = MAX_NUMBER_LABEL;
D_Axis.minorTicksPerInterval       = 0;
D_Axis.labelOffset                 = 3.0;
D_Axis.labelPositionY              = 0.0;
labelTextStyle.color = [CPTColor colorWithCGColor:D_Color.CGColor];
D_Axis.tickDirection               = CPTSignPositive;
D_Axis.labelTextStyle = labelTextStyle;
D_Axis.axisConstraints = [CPTConstraints constraintWithRelativeOffset:1.0];
D_Axis.plotSpace = _DSpace;

CPTXYAxis *E_Axis = [[CPTXYAxis alloc] init] ;
E_Axis.coordinate                  = CPTCoordinateY;
E_Axis.orthogonalCoordinateDecimal = CPTDecimalFromCGFloat(_ESpace.yRange.locationDouble);
E_Axis.labelingPolicy              = CPTAxisLabelingPolicyEqualDivisions;
E_Axis.majorGridLineStyle          = majorGridLineStyle;
E_Axis.preferredNumberOfMajorTicks = MAX_NUMBER_LABEL;
E_Axis.minorTicksPerInterval       = 0;
E_Axis.labelOffset                 = 3.0;
E_Axis.labelPositionY              = 11.0;
labelTextStyle.color               = [CPTColor colorWithCGColor:E_Color.CGColor];
E_Axis.tickDirection               = CPTSignPositive;
E_Axis.labelTextStyle              = labelTextStyle;
E_Axis.axisConstraints             = [CPTConstraints constraintWithRelativeOffset:1.0];
E_Axis.plotSpace                   = _ESpace;

CPTXYAxis *F_Axis = [[CPTXYAxis alloc] init] ;
F_Axis.coordinate                  = CPTCoordinateY;
F_Axis.orthogonalCoordinateDecimal = CPTDecimalFromCGFloat(_FSpace.yRange.locationDouble);
F_Axis.labelingPolicy              = CPTAxisLabelingPolicyEqualDivisions;
F_Axis.majorGridLineStyle          = majorGridLineStyle;
F_Axis.preferredNumberOfMajorTicks = MAX_NUMBER_LABEL;
F_Axis.minorTicksPerInterval       = 0;
F_Axis.labelOffset                 = 3.0;
F_Axis.labelPositionY              = -11.0;
labelTextStyle.color               = [CPTColor colorWithCGColor:F_Color.CGColor];
F_Axis.tickDirection               = CPTSignPositive;
F_Axis.labelTextStyle              = labelTextStyle;
F_Axis.axisConstraints             = [CPTConstraints constraintWithRelativeOffset:1.0];
F_Axis.plotSpace                   = _FSpace;

我已将 3 个第一个轴放在左侧(约束为 0),另一个放在图表的右侧。下面显示了一个问题示例,其中最后一个绿色标签不可见:

http://www.mathnormal.altervista.org/axis.png

提前致谢。

4

1 回答 1

0

这听起来可能是一个错误。使用固定间隔标记策略时可能会出现某种舍入误差。请在 Core Plot问题跟踪器上报告。

于 2013-05-30T23:43:39.203 回答