我想在Y轴上只画出10个Majors Ticks。为此我正在使用方法preferredNumberOfMajorTicks = 10
。
但正如屏幕截图所示,它并没有真正起作用......
这是我对y轴的配置:
CPTXYAxis *y = axisSet.yAxis;
y.labelingPolicy = CPTAxisLabelingPolicyFixedInterval;
//y.majorIntervalLength = CPTDecimalFromDouble(2);
y.preferredNumberOfMajorTicks = 10;
y.minorTicksPerInterval = 5;
y.tickDirection = CPTSignNone;
y.majorTickLineStyle = majorLineStyle;
y.minorTickLineStyle = minorLineStyle;
y.axisLineStyle = majorLineStyle;
y.majorTickLength = 7.0;
y.minorTickLength = 5.0;
y.labelTextStyle = whiteTextStyle;
y.minorTickLabelTextStyle = minorTickBlackTextStyle;
y.titleTextStyle = whiteTextStyle;
y.axisConstraints = [CPTConstraints constraintWithLowerOffset:40.0];
某些东西应该超过方法preferredNumberOfMajorTicks = 10
,但我看不出是什么......
答案 0 :(得分:7)
preferredNumberOfMajorTicks
属性不适用于固定间隔标签策略。有关详细信息,请参阅Core Plot docs。你有两个选择:
保留固定间隔标签政策,并将majorIntervalLength
更改为可提供所需滴答数的值。
将标签政策更改为CPTAxisLabelingPolicyAutomatic
或CPTAxisLabelingPolicyEqualDivisions
。