1

为了显示零值,我在绘图空间中添加了一个额外的 x 轴:

CPTMutableLineStyle *boldLineStyle = [xAxis.axisLineStyle mutableCopy];
boldLineStyle.lineWidth = 1;
boldLineStyle.lineColor = [CPTColor darkGrayColor];
boldLineStyle.lineCap   = kCGLineCapRound;

CPTXYAxis *xZeroAxis = [[CPTXYAxis alloc] init];
xZeroAxis.coordinate = CPTCoordinateX;
xZeroAxis.plotSpace = plotSpace;
xZeroAxis.axisLineStyle = boldLineStyle;

有趣的是,显示了这个轴上的标签,但没有显示轴本身:

xZeroAxis.axisLabels = [NSSet setWithArray:naLabels];
xZeroAxis.axisConstraints = [CPTConstraints constraintWithLowerOffset:0.0];
xyAxisSet.axes = @[xAxis, xLabelAxis, yAxis, xZeroAxis];

我需要如何更改代码以显示 x 轴?

谢谢!

在此处输入图像描述

x.axisLineStyle设置如下:

CPTMutableLineStyle *axisLineStyle = [CPTMutableLineStyle lineStyle];
axisLineStyle.lineWidth = 1.0;
axisLineStyle.lineCap   = kCGLineCapRound;
axisLineStyle.lineColor = [CPTColor darkGrayColor];
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
CPPTXYAxis *x = axisSet.xAxis;
x.axisLineStyle = axisLineStyle;
4

1 回答 1

0

这似乎是当前 Core Plot 版本中的一个错误。该问题已在此处报告:Core Plot Issue 514

于 2013-03-14T13:57:41.413 回答