iOS5 Core Plot 将图拟合到可见区域
我得到了一个图,我将 Y 范围定义为 -2000 到 2000
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(1) length:CPTDecimalFromInt(600)];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(-2000) length:CPTDecimalFromInt(2000)];
该图沿着 X 轴拟合到图形,导致 Y 轴的大部分被截断。我如何要求核心图自动缩放 Y 轴以使系列中的最大值恰好触摸屏幕顶部?
谢谢你!
I got a plot for which I defined the Y range as -2000 to 2000
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(1) length:CPTDecimalFromInt(600)];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(-2000) length:CPTDecimalFromInt(2000)];
The plot is fitted to the graph along the X axis, causing the majority of the Y axis to be cut off. How can I ask the core plot to autoscale the Y axis to make the maximum value in a series just touch the top of the screen?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
绘图范围由位置和长度定义,类似于
NSRange
。要制作介于 -2000 和 2000 之间的范围,yRange
的位置应为 -2000,长度为 4000。您可以使用
-scaleToFitPlots:
自动缩放绘图空间方法。几个 Core Plot 示例应用程序使用此方法来将绘图拟合到其数据。Plot ranges are defined by a location and a length, similar to
NSRange
. To make a range that spans between -2000 and 2000, youryRange
should have a location of -2000 and length 4000.You can autoscale a plot space using the
-scaleToFitPlots:
method. Several of the Core Plot example apps use this method to fit plots to their data.