开发者

Core Plot: How to set xRange/yRange with different scales?

I am wanting to use Altitude for my Y range and Distance for my X range. Currently this is what I am using:

plotSpace.xRange = [CPPlotRange 
                        plotRangeWithLocation:CPDecimalFromFloat(0.0) 
                        length:CPDecimalFromUnsignedInteger(sortedArray.count)];
plotSpace.yRange = [CPPlotRange 
                        plotRangeWithLocation:CPDecimalFromFloat(min) 
                        length:CPDecimalFromFloat((max - min))];

That doesn't set the X range correctly, becaus开发者_Python百科e it just sets it to the number of points in the array, which is about 2500. I have tried setting the xRange to to the max value in my distance array, but that really screws up the graph.

How can I have two different scales for x and y and still have the graph be correct?

Here is what it looks like when I change the xRange to be my distance, the graph goes flat:

Core Plot: How to set xRange/yRange with different scales?


Calculate your min and max distance and use those to set the xRange and calculate your min and max altitude and use those to set the yRange.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜