Core Plot (iOS and tvOS)
Cocoa plotting framework for macOS, iOS, and tvOS
<CPTPlotDataSource> Protocol Reference

A plot data source. More...

#import <CPTPlot.h>

+ Inheritance diagram for <CPTPlotDataSource>:
+ Collaboration diagram for <CPTPlotDataSource>:

Public Instance Methods

Data Values
(NSUInteger- numberOfRecordsForPlot:
 (Required) The number of data points for the plot. More...
 
(nullable NSArray *) - numbersForPlot:field:recordIndexRange:
 (Optional) Gets a range of plot data for the given plot and field. Implement one and only one of the optional methods in this section. More...
 
(nullable id- numberForPlot:field:recordIndex:
 (Optional) Gets a plot data value for the given plot and field. Implement one and only one of the optional methods in this section. More...
 
(nullable double *) - doublesForPlot:field:recordIndexRange:
 (Optional) Gets a range of plot data for the given plot and field. Implement one and only one of the optional methods in this section. More...
 
(double) - doubleForPlot:field:recordIndex:
 (Optional) Gets a plot data value for the given plot and field. Implement one and only one of the optional methods in this section. More...
 
(nullable CPTNumericData *) - dataForPlot:field:recordIndexRange:
 (Optional) Gets a range of plot data for the given plot and field. Implement one and only one of the optional methods in this section. More...
 
(nullable CPTNumericData *) - dataForPlot:recordIndexRange:
 (Optional) Gets a range of plot data for all fields of the given plot simultaneously. Implement one and only one of the optional methods in this section. More...
 
Data Labels
(nullable CPTLayerArray *) - dataLabelsForPlot:recordIndexRange:
 (Optional) Gets a range of data labels for the given plot. More...
 
(nullable CPTLayer *) - dataLabelForPlot:recordIndex:
 (Optional) Gets a data label for the given plot. This method will not be called if -dataLabelsForPlot:recordIndexRange: is also implemented in the datasource. More...
 
- Public Instance Methods inherited from <NSObject>
(NSString *) - description
 
(NSUInteger- hash
 
(BOOL- isEqual:
 

Detailed Description

A plot data source.

Method Documentation

◆ dataForPlot:field:recordIndexRange:

- (nullable CPTNumericData *) dataForPlot: (nonnull CPTPlot *)  plot
field: (NSUInteger fieldEnum
recordIndexRange: (NSRange indexRange 
optional

(Optional) Gets a range of plot data for the given plot and field. Implement one and only one of the optional methods in this section.

Parameters
plotThe plot.
fieldEnumThe field index.
indexRangeThe range of the data indexes of interest.
Returns
A one-dimensional array of data points.

◆ dataForPlot:recordIndexRange:

- (nullable CPTNumericData *) dataForPlot: (nonnull CPTPlot *)  plot
recordIndexRange: (NSRange indexRange 
optional

(Optional) Gets a range of plot data for all fields of the given plot simultaneously. Implement one and only one of the optional methods in this section.

The data returned from this method should be a two-dimensional array. It can be arranged in row- or column-major order although column-major will load faster, especially for large arrays. The array should have the same number of rows as the length of indexRange. The number of columns should be equal to the number of plot fields required by the plot. The column index (zero-based) corresponds with the field index. The data type will be converted to match the cachePrecision if needed.

Parameters
plotThe plot.
indexRangeThe range of the data indexes of interest.
Returns
A two-dimensional array of data points.

◆ dataLabelForPlot:recordIndex:

- (nullable CPTLayer *) dataLabelForPlot: (nonnull CPTPlot *)  plot
recordIndex: (NSUInteger idx 

(Optional) Gets a data label for the given plot. This method will not be called if -dataLabelsForPlot:recordIndexRange: is also implemented in the datasource.

Parameters
plotThe plot.
idxThe data index of interest.
Returns
The data label for the point with the given index. If you return nil, the default data label will be used. If you return an instance of NSNull, no label will be shown for the index in question.

◆ dataLabelsForPlot:recordIndexRange:

- (nullable CPTLayerArray *) dataLabelsForPlot: (nonnull CPTPlot *)  plot
recordIndexRange: (NSRange indexRange 

(Optional) Gets a range of data labels for the given plot.

Parameters
plotThe plot.
indexRangeThe range of the data indexes of interest.
Returns
An array of data labels.

◆ doubleForPlot:field:recordIndex:

- (double) doubleForPlot: (nonnull CPTPlot *)  plot
field: (NSUInteger fieldEnum
recordIndex: (NSUInteger idx 
optional

(Optional) Gets a plot data value for the given plot and field. Implement one and only one of the optional methods in this section.

Parameters
plotThe plot.
fieldEnumThe field index.
idxThe data index of interest.
Returns
A data point.

◆ doublesForPlot:field:recordIndexRange:

- (nullable double *) doublesForPlot: (nonnull CPTPlot *)  plot
field: (NSUInteger fieldEnum
recordIndexRange: (NSRange indexRange 
optional

(Optional) Gets a range of plot data for the given plot and field. Implement one and only one of the optional methods in this section.

Parameters
plotThe plot.
fieldEnumThe field index.
indexRangeThe range of the data indexes of interest.
Returns
A retained C array of data points.

◆ numberForPlot:field:recordIndex:

- (nullable id) numberForPlot: (nonnull CPTPlot *)  plot
field: (NSUInteger fieldEnum
recordIndex: (NSUInteger idx 
optional

(Optional) Gets a plot data value for the given plot and field. Implement one and only one of the optional methods in this section.

For fields where the plotSpace scale type is CPTScaleTypeCategory, this method should return an NSString containing the category name. Otherwise, it should return an NSNumber holding the data value. For any scale type, return nil or an instance of NSNull to indicate missing values.

Parameters
plotThe plot.
fieldEnumThe field index.
idxThe data index of interest.
Returns
A data point.

◆ numberOfRecordsForPlot:

- (NSUInteger) numberOfRecordsForPlot: (nonnull CPTPlot *)  plot

(Required) The number of data points for the plot.

Parameters
plotThe plot.
Returns
The number of data points for the plot.

◆ numbersForPlot:field:recordIndexRange:

- (nullable NSArray *) numbersForPlot: (nonnull CPTPlot *)  plot
field: (NSUInteger fieldEnum
recordIndexRange: (NSRange indexRange 
optional

(Optional) Gets a range of plot data for the given plot and field. Implement one and only one of the optional methods in this section.

For fields where the plotSpace scale type is CPTScaleTypeCategory, this method should return an array of NSString objects containing the category names. Otherwise, it should return an array of NSNumber objects holding the data values. For any scale type, include instances of NSNull in the array to indicate missing values.

Parameters
plotThe plot.
fieldEnumThe field index.
indexRangeThe range of the data indexes of interest.
Returns
An array of data points.

The documentation for this protocol was generated from the following file: