如何使核心图的y轴标记为.5

时间:2019-05-14 14:47:23

标签: objective-c core-plot

我正在尝试将y轴标记设置为.5,但不能使其小于一个。这是我的代码。有什么建议么?谢谢

// 4 - Configure y-axis
CPTAxis *y = axisSet.yAxis;
y.title = @"";
y.titleTextStyle = axisTitleStyle;
y.titleOffset = -40.0f;
y.axisLineStyle = axisLineStyle;
y.majorGridLineStyle = gridLineStyle;
y.labelingPolicy = CPTAxisLabelingPolicyNone;
y.labelTextStyle = axisTextStyle;
y.labelOffset = 16.0f;
y.majorTickLineStyle = axisLineStyle;
y.majorTickLength = 4.0f;
y.minorTickLength = 2.0f;
y.tickDirection = CPTSignPositive;

NSInteger majorIncrement;
NSInteger minorIncrement;

// set if here to check for inr  5-13
if (self.iNRFlag) {
    majorIncrement = 1;
    minorIncrement = 1;
} else {
    majorIncrement = self.glucoseTick;
    minorIncrement = self.glucoseHalfTick;
}

1 个答案:

答案 0 :(得分:0)

提供的代码不会创建任何刻度线或标签。如果要均匀分布刻度线,请使用默认标签策略(CPTAxisLabelingPolicyFixedInterval)并将majorIntervalLength设置为@0.5。将minorTicksPerInterval设置为大于一(1)的值,以便在主要刻度线之间插入次要刻度线。将labelFormatter设置为新的NSFormatter,以控制刻度标签的格式。