您正在使用哪個版本的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