核心情节iOS逆转Y轴 [英] core-plot iOS reversed Y axis
问题描述
我想使用核心图来显示水深图(实时更新)但我无法弄清楚如何反转Y轴,以便X轴(代表时域)打开我的UIView的顶部和Y轴以正值向下增长。
I would like to use core-plot to display a water depth graph (updated in real time) but I can't figure out how to reverse the Y axis, so that the X axis (representing the time domain) is on the top of my UIView and the Y axis grows towards the bottom with positive values.
编辑
如果我能画这样的轴会更好:
- X轴是时间
- Y轴从0到X(X> 0)并且在顶部有0,在底部有X
- X轴在底部
It would be even better if I could draw axes like this:
- X axis is time
- Y axis is from 0 to X (X > 0) and on the top there is 0, on the bottom there is X
- X axis is on the bottom
ASCII版本:
0 |
1 |
。
。
。< br>
x |
--------------------------
0 1 2 3 4 5 6 7 ...
0 |
1 |
.
.
.
x |
--------------------------
0 1 2 3 4 5 6 7 ...
推荐答案
您可以使用负长度绘制范围来反转轴的方向。例如(来自CPTTestApp中的轴演示):
You can use a negative length for the plot range to reverse the direction of an axis. For example (from the axis demo in CPTTestApp):
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0)
length:CPTDecimalFromDouble(-10.0)];
这篇关于核心情节iOS逆转Y轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!