IOS CorePlot停靠垂直轴
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IOS CorePlot停靠垂直轴相关的知识,希望对你有一定的参考价值。
Begin by making the class a CPPlotSpaceDelegate.
// in the viewDidLoad Method: // CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace; // plotSpace.delegate = self; /* * "Dock" the Y-axis and only allow horizontal scrolling toward the right. */ - (CPPlotRange *)plotSpace:(CPPlotSpace *)space willChangePlotRangeTo:(CPPlotRange *)newRange forCoordinate:(CPCoordinate)coordinate { NSLog(@"WillChangePlotRangeTo"); // only allows scrolling to the right // remove this to have scrolling in both directions if (newRange.locationDouble < 0.0F) { newRange.location = CPDecimalFromFloat(0.0); } // Adjust axis to keep them in view at the left and bottom; // adjust scale-labels to match the scroll. CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet; if (coordinate == CPCoordinateX) { axisSet.yAxis.orthogonalCoordinateDecimal = newRange.location; axisSet.xAxis.titleLocation = CPDecimalFromFloat(newRange.locationDouble + (newRange.lengthDouble / 2.0F)); } else { axisSet.xAxis.orthogonalCoordinateDecimal = newRange.location; axisSet.yAxis.titleLocation = CPDecimalFromFloat(newRange.locationDouble + (newRange.lengthDouble / 2.0F)); } return newRange; }
以上是关于IOS CorePlot停靠垂直轴的主要内容,如果未能解决你的问题,请参考以下文章