我试图让我的X和Y轴标题显示,但似乎它们并不总是有效:
CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet;
CPXYAxis *x = axisSet.xAxis;
x.orthogonalCoordinateDecimal = CPDecimalFromFloat(min);
x.title = [NSString stringWithFormat:@"Distance %@", distLabel];
x.titleLocation = CPDecimalFromFloat(7.5f);
x.titleOffset = 55.0f;
CPXYAxis *y = axisSet.yAxis;
y.orthogonalCoordinateDecimal = CPDecimalFromFloat(minDist);
y.title = @"Altitude";
y.titleOffset = 95.0f;
y.titleLocation = CPDecimalFromFloat(150.0f);
有时X标题会显示,但Y轴标题永远不会显示。他们为什么不露面?它是填充物吗?
plotAreaFrame.paddingLeft = 50;
plotAreaFrame.paddingTop = 10;
plotAreaFrame.paddingRight = 20;
plotAreaFrame.paddingBottom = 50;
答案 0 :(得分:1)
您需要增加底部和左侧填充。您的标题偏移量大于两个轴上的标题偏移量,因此隐藏了标题。