Core Plot (iOS and tvOS)
Cocoa plotting framework for macOS, iOS, and tvOS
CPTFunctionDataSource Class Reference

A datasource class that automatically creates scatter plot data from a function or Objective-C block. More...

#import <CPTFunctionDataSource.h>

+ Inheritance diagram for CPTFunctionDataSource:
+ Collaboration diagram for CPTFunctionDataSource:

Public Class Methods

Factory Methods
(nonnull instancetype) + dataSourceForPlot:withFunction:
 Creates and returns a new CPTFunctionDataSource instance initialized with the provided function and plot. More...
 
(nonnull instancetype) + dataSourceForPlot:withBlock:
 Creates and returns a new CPTFunctionDataSource instance initialized with the provided block and plot. More...
 
- Public Class Methods inherited from NSObject
(id+ alloc
 
(Class+ class
 
(void) + initialize
 
(void) + load
 
(id+ new
 

Public Instance Methods

Initialization
(nonnull instancetype) - initForPlot:withFunction:
 Initializes a newly allocated CPTFunctionDataSource object with the provided function and plot. More...
 
(nonnull instancetype) - initForPlot:withBlock:
 Initializes a newly allocated CPTFunctionDataSource object with the provided block and plot. More...
 
- Public Instance Methods inherited from NSObject
(Class- classForCoder
 
(id- copy
 
(void) - dealloc
 
(void) - finalize
 
(id- init
 
(id- mutableCopy
 
- Public Instance Methods inherited from <NSObject>
(NSString *) - description
 
(NSUInteger- hash
 
(BOOL- isEqual:
 
- Public Instance Methods inherited from <CPTPlotDataSource>
(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...
 
(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...
 

Properties

CPTDataSourceFunction dataSourceFunction
 The function used to generate plot data. More...
 
CPTDataSourceBlock dataSourceBlock
 The Objective-C block used to generate plot data. More...
 
CPTPlotdataPlot
 The plot that will display the function values. Must be an instance of CPTScatterPlot. More...
 
CGFloat resolution
 The maximum number of pixels between data points on the plot. Default is 1.0. More...
 
CPTPlotRangedataRange
 The maximum range of x-values that will be plotted. If nil (the default), the function will be plotted for all visible x-values. More...
 

Detailed Description

A datasource class that automatically creates scatter plot data from a function or Objective-C block.

Method Documentation

◆ dataSourceForPlot:withBlock:

+ (nonnull instancetype) dataSourceForPlot: (nonnull CPTPlot *)  plot
withBlock: (nonnull CPTDataSourceBlock block 

Creates and returns a new CPTFunctionDataSource instance initialized with the provided block and plot.

Parameters
plotThe plot that will display the function values.
blockThe Objective-C block used to generate plot data.
Returns
A new CPTFunctionDataSource instance initialized with the provided block and plot.

◆ dataSourceForPlot:withFunction:

+ (nonnull instancetype) dataSourceForPlot: (nonnull CPTPlot *)  plot
withFunction: (nonnull CPTDataSourceFunction function 

Creates and returns a new CPTFunctionDataSource instance initialized with the provided function and plot.

Parameters
plotThe plot that will display the function values.
functionThe function used to generate plot data.
Returns
A new CPTFunctionDataSource instance initialized with the provided function and plot.

◆ initForPlot:withBlock:

- (nonnull instancetype) initForPlot: (nonnull CPTPlot *)  plot
withBlock: (nonnull CPTDataSourceBlock block 

Initializes a newly allocated CPTFunctionDataSource object with the provided block and plot.

Parameters
plotThe plot that will display the function values.
blockThe Objective-C block used to generate plot data.
Returns
The initialized CPTFunctionDataSource object.

◆ initForPlot:withFunction:

- (nonnull instancetype) initForPlot: (nonnull CPTPlot *)  plot
withFunction: (nonnull CPTDataSourceFunction function 

Initializes a newly allocated CPTFunctionDataSource object with the provided function and plot.

Parameters
plotThe plot that will display the function values.
functionThe function used to generate plot data.
Returns
The initialized CPTFunctionDataSource object.

Property Documentation

◆ dataPlot

- (nonnull CPTPlot *) dataPlot
readnonatomicassign

The plot that will display the function values. Must be an instance of CPTScatterPlot.

◆ dataRange

- (nullable CPTPlotRange *) dataRange
readwritenonatomicstrong

The maximum range of x-values that will be plotted. If nil (the default), the function will be plotted for all visible x-values.

◆ dataSourceBlock

- (nullable CPTDataSourceBlock) dataSourceBlock
readnonatomicassign

The Objective-C block used to generate plot data.

◆ dataSourceFunction

- (nullable CPTDataSourceFunction) dataSourceFunction
readnonatomicassign

The function used to generate plot data.

◆ resolution

- (CGFloat) resolution
readwritenonatomicassign

The maximum number of pixels between data points on the plot. Default is 1.0.


The documentation for this class was generated from the following files: