Core-Plot学习一 基本对象、添加库

首先看一下整体的绘图区域划分:

CPTGraph是Core Plot的核心类,在coreplot中graph就是整个图表,包括:坐标轴,标签,标题,以及多个图表元素。

Plot Area :

图表显示的区域,该区域被坐标轴限制在一定方位内,可以显示栅格在该区域,每个图表视图只能有一个图标区域,

Plot Spaces :

我这里想称Plot space为图表元素原型,比如说柱状图,他有更多个柱元素组成,其中的一个就是元素原型。这时个人理解

而Plot Spaces就是元素原型和坐标系的映射关系集合,

一个PLot space 元素原型会知道图表上,必须要实现以下方法:完成数据和坐标空间的转换

    -(CGPoint)plotAreaViewPointForPlotPoint:(NSDecimal *)plotPoint;    
    -(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(doubledouble *)plotPoint;    
    -(void)plotPoint:(NSDecimal *)plotPoint forPlotAreaViewPoint:(CGPoint)point;    
    -(void)doublePrecisionPlotPoint:(doubledouble *)plotPoint forPlotAreaViewPoint:(CGPoint)point;  
View Code

Plots :

Plot就是一个数据在图表中的表现形式,比如条形,柱状型等,

CPTPlot的dataSource方法

    @protocol CPTPlotDataSource <NSObject>    
      
    -(NSUInteger)numberOfRecords;     
      
    @optional    
      
    // Implement one of the following    
    -(NSArray *)numbersForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange;    
    -(NSNumber *)numberForPlot:(CPPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index;     
      
    @end   

Axes :

坐标轴

CPTAxis     和CPTPlotSpace有密切关系,CPTXYAxisSet包含多个CPTAxisCPTAxis中的标签元素可以自定义的。

配置Core-Plot库

1.在工程中添加 Core Plot 库

2.添加依赖库QuartzCore.framework

3.设置编译环境,在 build setting 中查找 other linker flags,添加 '-all_load -ObjC' 标志

 

corePlot好的博客: http://m.blog.csdn.net/blog/lushuoan/41791513

            http://m.blog.csdn.net/blog/lushuoan/41790641

          http://m.blog.csdn.net/blog/lushuoan/41699455

          http://m.blog.csdn.net/blog/lushuoan/39477813

 

 
原文地址:https://www.cnblogs.com/mins/p/4597274.html