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軸?
謝謝!
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;
什麼是'xAxis.axisLineStyle'?如果它是'nil','boldLineStyle'也是。 – 2013-02-24 22:08:30
@Eric,我添加了'x.axisLineStyle'的代碼。看起來我的圖表沒有顯示任何座標軸(x,xZeroAxis,y)。你能再看一遍嗎?謝謝! – AlexR 2013-02-25 13:35:26
我沒有看到問題中發佈的代碼中的任何問題。 – 2013-02-26 01:33:47