iOS5 Core Plot fit plot to visible area

徘徊边缘 提交于 2019-12-08 10:28:45

问题


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!


回答1:


Plot ranges are defined by a location and a length, similar to NSRange. To make a range that spans between -2000 and 2000, your yRange 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.



来源:https://stackoverflow.com/questions/7829660/ios5-core-plot-fit-plot-to-visible-area

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!