background image

//询问有多少个数据,在 CPTPlotDataSource 中声明的
- (NSUInteger) numberOfRecordsForPlot:(CPTPlot *)plot {
    return [dataArray count];
}
 
//询问一个个数据值,在 CPTPlotDataSource 中声明的
-  (NSNumber  *)  numberForPlot:(CPTPlot  *)plot  field:(NSUInteger)fieldEnum  recordIndex:
(NSUInteger)index {
    if(fieldEnum == CPTScatterPlotFieldY){    //询问 Y 值时
        return [dataArray objectAtIndex:index];
    }else{                                    //询问 X 值时
        return [NSNumber numberWithInt:index];
    }
}
 
- (void) dealloc {
    [dataArray release];
    [super dealloc];
}
 
@end