nul*_*cgo 1 iphone sdk core-plot
iPhone sdk:核心情节如何在右侧显示y轴?
我现在在iphone sdk中使用Core-plot,
这就是我到目前为止所做的

但我想把Yaxis放在右手边.
我启用了allowuserInteractive
**plotSpace.allowsUserInteraction=NO;
volumePlotSpace.allowsUserInteraction=YES;**
Run Code Online (Sandbox Code Playgroud)
但我希望X轴和Y轴始终保持在右侧和底部,
无论用户规模大小......
像这样:

ayo*_*yoy 14
您使用的是哪个版本的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;
Run Code Online (Sandbox Code Playgroud)
我不知道引入了哪个版本,但至少对于Core-Plot 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;
Run Code Online (Sandbox Code Playgroud)
我想对于右手边yConstraints应该是{CPConstraintNone, CPConstraintFixed}.
| 归档时间: |
|
| 查看次数: |
4576 次 |
| 最近记录: |