您正在使用哪个版本的Core-Plot?
Core-Plot 0.9允许您在轴位置上设置约束。像这样的代码行应该做的工作:
// 'graph' is your CPTXYGraph object
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
// move axis to the rightmost position
axisSet.yAxis.axisConstraints = [CPTConstraints constraintWithUpperOffset:0];
// put ticks on the right hand side of the axis
axisSet.yAxis.tickDirection = CPTSignPositive;
// add some padding to the right so that labels are actually visible
graph.plotAreaFrame.paddingRight = 20.0f;
我不知道在这个版本被引入,但至少睿情节0.2.2程序有点不同。我没有在我的箱子,所以我现在不能检查,但是这是如何解决在左侧Y轴:
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
axisSet.yAxis.isFloatingAxis = YES;
// fixed lower constraint, no upper constraint
CPConstraints yConstraints = {CPConstraintFixed, CPConstraintNone};
axisSet.yAxis.constraints = yConstraints;
我想这对于右侧yConstraints应该{CPConstraintNone, CPConstraintFixed}
。
您介意添加我的MSN或电子邮件吗? – nullmicgo
我还有一些关于核心图的问题, – nullmicgo
我有另外一个问题,请看这个链接,谢谢>。< http://stackoverflow.com/questions/7819472/iphone-core-plot-chart-zoom在缩小y轴更大y轴更小 – nullmicgo