我正在使用 CorePlot 根据特定设计绘制条形图,但无法让 Y 轴上的刻度居中。我的意思是一半的刻度应该在轴的左侧,另一半在右侧。
这是我到目前为止使用的代码:
CPTLineStyle *majorTickStyle = [[CPTMutableLineStyle alloc] init];
majorTickStyle.lineColor = GlobalColors.lightPinkColor.CPTColor;
CPTLineStyle *minorTickStyle = [[CPTMutableLineStyle alloc] init];
minorTickStyle.lineColor = GlobalColors.greyColor.CPTColor;
CPTXYAxis *y = axisSet.yAxis;
//y.titleOffset = 50.0f;
y.labelingPolicy = CPTAxisLabelingPolicyAutomatic;
y.majorGridLineStyle = majorGridLineStyle;
y.minorGridLineStyle = minorGridLineStyle;
y.axisConstraints = [CPTConstraints constraintWithUpperOffset:0];
y.tickDirection = CPTSignPositive;
y.majorTickLineStyle = majorTickStyle;
y.majorTickLength = 10;
y.minorTickLineStyle = minorTickStyle;
y.labelTextStyle = axisLabelStyle;
左边的图像是上面的代码给我的,右边是设计者呈现的(即我想要实现的):(
我不太担心滴答数和“L”数字末尾完全是一个单独的问题)