IOS CorePlot停靠垂直轴

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IOS CorePlot停靠垂直轴相关的知识,希望对你有一定的参考价值。

Begin by making the class a CPPlotSpaceDelegate.
  1. // in the viewDidLoad Method:
  2. // CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace;
  3. // plotSpace.delegate = self;
  4.  
  5. /*
  6.  * "Dock" the Y-axis and only allow horizontal scrolling toward the right.
  7.  */
  8. - (CPPlotRange *)plotSpace:(CPPlotSpace *)space
  9. willChangePlotRangeTo:(CPPlotRange *)newRange
  10. forCoordinate:(CPCoordinate)coordinate {
  11.  
  12. NSLog(@"WillChangePlotRangeTo");
  13.  
  14. // only allows scrolling to the right
  15. // remove this to have scrolling in both directions
  16. if (newRange.locationDouble < 0.0F) {
  17. newRange.location = CPDecimalFromFloat(0.0);
  18. }
  19.  
  20. // Adjust axis to keep them in view at the left and bottom;
  21. // adjust scale-labels to match the scroll.
  22. CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet;
  23. if (coordinate == CPCoordinateX) {
  24. axisSet.yAxis.orthogonalCoordinateDecimal = newRange.location;
  25. axisSet.xAxis.titleLocation = CPDecimalFromFloat(newRange.locationDouble +
  26. (newRange.lengthDouble / 2.0F));
  27. } else {
  28. axisSet.xAxis.orthogonalCoordinateDecimal = newRange.location;
  29. axisSet.yAxis.titleLocation = CPDecimalFromFloat(newRange.locationDouble +
  30. (newRange.lengthDouble / 2.0F));
  31. }
  32.  
  33. return newRange;
  34. }

以上是关于IOS CorePlot停靠垂直轴的主要内容,如果未能解决你的问题,请参考以下文章

CorePlot 中的缩放轴

iOS导入CorePlot用于绘制饼图

ios中的Coreplot构建失败问题

核心图:捏以更改 x 轴范围

CorePlot 在 iOS7 应用程序/Xcode5 中抛出异常

垂直滚动中带有左侧停靠标题的自定义 UICollectionViewLayout