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

An abstract plot class. More...

#import <CPTPlot.h>

+ Inheritance diagram for CPTPlot:
+ Collaboration diagram for CPTPlot:

Public Instance Methods

(void) - reloadPlotDataInIndexRange: [implementation]
 Reload plot data in the given index range from the data source immediately. More...
 
(nullable NSString *) - titleForLegendEntryAtIndex: [implementation]
 The title text of a legend entry. More...
 
(nullable NSAttributedString *) - attributedTitleForLegendEntryAtIndex: [implementation]
 The styled title text of a legend entry. More...
 
(nonnull CPTNumberArray *) - fieldIdentifiersForCoordinate: [implementation]
 The field identifiers that correspond to a particular coordinate. More...
 
(CPTCoordinate- coordinateForFieldIdentifier: [implementation]
 The coordinate value that corresponds to a particular field identifier. More...
 
(void) - positionLabelAnnotation:forIndex: [implementation]
 Adjusts the position of the data label annotation for the plot point at the given index. More...
 
(NSUInteger- dataIndexFromInteractionPoint: [implementation]
 Determines the index of the data element that is under the given point. More...
 
Plot Data Ranges
(nullable CPTPlotRange *) - plotRangeForField:
 Determines the smallest plot range that fully encloses the data for a particular field. More...
 
(nullable CPTPlotRange *) - plotRangeForCoordinate:
 Determines the smallest plot range that fully encloses the data for a particular coordinate. More...
 
(nullable CPTPlotRange *) - plotRangeEnclosingField:
 Determines the smallest plot range that fully encloses the entire plot for a particular field. More...
 
(nullable CPTPlotRange *) - plotRangeEnclosingCoordinate:
 Determines the smallest plot range that fully encloses the entire plot for a particular coordinate. More...
 
Initialization
(nonnull instancetype) - initWithFrame: [implementation]
 Initializes a newly allocated CPTPlot object with the provided frame rectangle. More...
 
User Interaction
(BOOL- pointingDeviceDownEvent:atPoint: [implementation]
 Informs the receiver that the user has started touching the screen. More...
 
(BOOL- pointingDeviceUpEvent:atPoint: [implementation]
 Informs the receiver that the user has ended touching the screen. More...
 
(NSUInteger- dataIndexFromInteractionPoint:
 
Fields
(NSUInteger- numberOfFields
 Number of fields in a plot data record. More...
 
(nonnull CPTNumberArray *) - fieldIdentifiers
 Identifiers (enum values) identifying the fields. More...
 
(nonnull CPTNumberArray *) - fieldIdentifiersForCoordinate:
 
(CPTCoordinate- coordinateForFieldIdentifier:
 
- Public Instance Methods inherited from CPTAnnotationHostLayer
(void) - addAnnotation:
 Adds an annotation to the receiver. More...
 
(void) - removeAnnotation:
 Removes an annotation from the receiver. More...
 
(void) - removeAllAnnotations
 Removes all annotations from the receiver. More...
 
(BOOL- pointingDeviceDraggedEvent:atPoint: [implementation]
 Informs the receiver that the user has moved their finger while touching the screen. More...
 
(BOOL- pointingDeviceCancelledEvent: [implementation]
 Informs the receiver that tracking of touches has been cancelled for any reason. More...
 
- Public Instance Methods inherited from CPTLayer
(nullable instancetype) - initWithCoder:
 Returns an object initialized from data in a given unarchiver. More...
 
(nonnull instancetype) - initWithLayer:
 Override to copy or initialize custom fields of the specified layer. More...
 
(nonnull instancetype) - init [implementation]
 Initializes a newly allocated CPTLayer object with an empty frame rectangle. More...
 
(void) - logLayers
 Logs this layer and all of its sublayers. More...
 
(BOOL- pointingDeviceDownEvent:atPoint: [implementation]
 
(BOOL- pointingDeviceUpEvent:atPoint: [implementation]
 
(BOOL- pointingDeviceDraggedEvent:atPoint: [implementation]
 
(BOOL- pointingDeviceCancelledEvent: [implementation]
 
(nullable CPTNativeImage *) - imageOfLayer
 Gets an image of the layer contents. More...
 
(void) - setNeedsDisplayAllLayers
 Recursively marks this layer and all sublayers as needing to be redrawn. More...
 
(void) - renderAsVectorInContext:
 Draws layer content into the provided graphics context. More...
 
(void) - recursivelyRenderInContext:
 Draws layer content and the content of all sublayers into the provided graphics context. More...
 
(void) - layoutAndRenderInContext:
 Updates the layer layout if needed and then draws layer content and the content of all sublayers into the provided graphics context. More...
 
(nonnull NSData *) - dataForPDFRepresentationOfLayer
 Draws layer content and the content of all sublayers into a PDF document. More...
 
(void) - applySublayerMaskToContext:forSublayer:withOffset:
 Recursively sets the clipping path of the given graphics context to the sublayer masking paths of its superlayers. More...
 
(void) - applyMaskToContext:
 Sets the clipping path of the given graphics context to mask the content. More...
 
(void) - pixelAlign
 Align the receiver’s position with pixel boundaries. More...
 
(void) - sublayerMarginLeft:top:right:bottom:
 Returns the margins that should be left between the bounds of the receiver and all sublayers. More...
 
(void) - layoutSublayers [implementation]
 Updates the layout of all sublayers. Sublayers fill the super layer’s bounds minus any padding. More...
 
- Public Instance Methods inherited from CALayer
(BOOL- containsPoint:
 
(void) - drawInContext:
 
(id- init
 
(id- initWithLayer
 
(void) - layoutSublayers
 
(void) - setNeedsDisplay
 
(void) - setNeedsDisplayInRect:
 
(void) - setNeedsLayout
 
- 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:
 
User Interaction

Properties

Data Source
id< CPTPlotDataSourcedataSource
 The data source for the plot. More...
 
Identification
NSStringtitle
 The title of the plot displayed in the legend. More...
 
NSAttributedStringattributedTitle
 The styled title of the plot displayed in the legend. More...
 
Plot Space
CPTPlotSpaceplotSpace
 The plot space for the plot. More...
 
Plot Area
CPTPlotAreaplotArea
 The plot area for the plot. More...
 
Drawing
BOOL alignsPointsToPixels
 If YES (the default), all plot points will be aligned to device pixels when drawing. More...
 
- Properties inherited from CPTAnnotationHostLayer
CPTAnnotationArrayannotations
 An array of annotations attached to this layer. More...
 
- Properties inherited from CPTLayer
CPTGraphgraph
 The graph for the layer. More...
 
CGFloat paddingLeft
 Amount to inset the left side of each sublayer. More...
 
CGFloat paddingTop
 Amount to inset the top of each sublayer. More...
 
CGFloat paddingRight
 Amount to inset the right side of each sublayer. More...
 
CGFloat paddingBottom
 Amount to inset the bottom of each sublayer. More...
 
id< NSCopying, NSCoding, NSObjectidentifier
 An object used to identify the layer in collections. More...
 
CGFloat contentsScale
 The scale factor applied to the layer. More...
 
BOOL useFastRendering
 If YES, subclasses should optimize their drawing for speed over precision. More...
 
CPTShadowshadow
 The shadow drawn under the layer content. If nil (the default), no shadow is drawn. More...
 
CGSize shadowMargin
 The maximum margin size needed to fully enclose the layer shadow. More...
 
BOOL masksToBorder
 If YES, a sublayer mask is applied to clip sublayer content to the inside of the border. More...
 
CGPathRef outerBorderPath
 A drawing path that encompasses the outer boundary of the layer border. More...
 
CGPathRef innerBorderPath
 A drawing path that encompasses the inner boundary of the layer border. More...
 
CGPathRef maskingPath
 A drawing path that encompasses the layer content including any borders. Set to NULL when no masking is desired. More...
 
CGPathRef sublayerMaskingPath
 A drawing path that encompasses the layer content excluding any borders. Set to NULL when no masking is desired. More...
 
CPTSublayerSetsublayersExcludedFromAutomaticLayout
 A set of sublayers that should be excluded from the automatic sublayer layout. More...
 
- Properties inherited from CALayer
CGPoint anchorPoint
 
CGRect bounds
 
CGFloat contentsScale
 
CGFloat cornerRadius
 
id delegate
 
CGRect frame
 
BOOL masksToBounds
 
BOOL needsDisplayOnBoundsChange
 
BOOL opacity
 
BOOL opaque
 
- Properties inherited from <CAMediaTiming>
BOOL autoreverses
 
CFTimeInterval beginTime
 
CFTimeInterval duration
 
NSStringfillMode
 
float repeatCount
 
id repeatDuration
 
float speed
 
CFTimeInterval timeOffset
 

Data Loading

BOOL dataNeedsReloading
 If YES, the plot data will be reloaded from the data source before the layer content is drawn. More...
 
(void) - setDataNeedsReloading
 Marks the receiver as needing the data source reloaded before the content is next drawn. More...
 
(void) - reloadData
 Reload all plot data, labels, and plot-specific information from the data source immediately. More...
 
(void) - reloadDataIfNeeded
 Reload plot data from the data source only if the data cache is out of date. More...
 
(void) - reloadDataInIndexRange:
 Reload plot data, labels, and plot-specific information in the given index range from the data source immediately. More...
 
(void) - insertDataAtIndex:numberOfRecords:
 Insert records into the plot data cache at the given index. More...
 
(void) - deleteDataInIndexRange:
 Delete records in the given index range from the plot data cache. More...
 
(void) - reloadPlotData
 Reload all plot data from the data source immediately. More...
 
(void) - reloadPlotDataInIndexRange:
 

Data Cache

NSUInteger cachedDataCount
 The number of data points stored in the cache. More...
 
BOOL doublePrecisionCache
 If YES, the cache holds data of type double, otherwise it holds NSDecimal. More...
 
CPTPlotCachePrecision cachePrecision
 The numeric precision used to cache the plot data and perform all plot calculations. Defaults to CPTPlotCachePrecisionAuto. More...
 
CPTNumericDataType doubleDataType
 The CPTNumericDataType used to cache plot data as double. More...
 
CPTNumericDataType decimalDataType
 The CPTNumericDataType used to cache plot data as NSDecimal. More...
 
(nullable CPTMutableNumericData *) - cachedNumbersForField:
 Retrieves an array of numbers from the cache. More...
 
(nullable NSNumber *) - cachedNumberForField:recordIndex:
 Retrieves a single number from the cache. More...
 
(double) - cachedDoubleForField:recordIndex:
 Retrieves a single number from the cache. More...
 
(NSDecimal- cachedDecimalForField:recordIndex:
 Retrieves a single number from the cache. More...
 
(nullable NSArray *) - cachedArrayForKey:
 Retrieves an array of values from the cache. More...
 
(nullable id- cachedValueForKey:recordIndex:
 Retrieves a single value from the cache. More...
 
(void) - cacheNumbers:forField:
 Copies an array of numbers to the cache. More...
 
(void) - cacheNumbers:forField:atRecordIndex:
 Copies an array of numbers to replace a part of the cache. More...
 
(void) - cacheArray:forKey:
 Copies an array of arbitrary values to the cache. More...
 
(void) - cacheArray:forKey:atRecordIndex:
 Copies an array of arbitrary values to replace a part of the cache. More...
 

Data Labels

BOOL needsRelabel
 If YES, the plot needs to be relabeled before the layer content is drawn. More...
 
BOOL adjustLabelAnchors
 If YES, data labels anchor points are adjusted automatically when the labels are positioned. If NO, data labels anchor points do not change. More...
 
BOOL showLabels
 Set to NO to override all other label settings and hide the data labels. Defaults to YES. More...
 
CGFloat labelOffset
 The distance that labels should be offset from their anchor points. The direction of the offset is defined by subclasses. More...
 
CGFloat labelRotation
 The rotation of the data labels in radians. Set this property to Ï€/2 to have labels read up the screen, for example. More...
 
NSUInteger labelField
 The plot field identifier of the data field used to generate automatic labels. More...
 
CPTTextStylelabelTextStyle
 The text style used to draw the data labels. Set this property to nil to hide the data labels. More...
 
NSFormatterlabelFormatter
 The number formatter used to format the data labels. Set this property to nil to hide the data labels. If you need a non-numerical label, such as a date, you can use a formatter than turns the numerical plot coordinate into a string (e.g., “Jan 10, 2010”). The CPTCalendarFormatter and CPTTimeFormatter classes are useful for this purpose. More...
 
CPTShadowlabelShadow
 The shadow applied to each data label. More...
 
(void) - setNeedsRelabel
 Marks the receiver as needing to update all data labels before the content is next drawn. More...
 
(void) - relabel
 Updates the data labels in the labelIndexRange. More...
 
(void) - relabelIndexRange:
 Marks the receiver as needing to update a range of data labels before the content is next drawn. More...
 
(void) - repositionAllLabelAnnotations
 Repositions all existing label annotations. More...
 
(void) - reloadDataLabels
 Reload all data labels from the data source immediately. More...
 
(void) - reloadDataLabelsInIndexRange:
 Reload data labels in the given index range from the data source immediately. More...
 
(void) - positionLabelAnnotation:forIndex:
 

Legends

BOOL drawLegendSwatchDecoration
 If YES (the default), additional plot-specific decorations, symbols, and/or colors will be drawn on top of the legend swatch rectangle. More...
 
(NSUInteger- numberOfLegendEntries
 The number of legend entries provided by this plot. More...
 
(nullable NSString *) - titleForLegendEntryAtIndex:
 
(nullable NSAttributedString *) - attributedTitleForLegendEntryAtIndex:
 
(void) - drawSwatchForLegend:atIndex:inRect:inContext:
 Draws the legend swatch of a legend entry. Subclasses should call super to draw the background fill and border. More...
 

Plot Data

(nullable id- numbersFromDataSourceForField:recordIndexRange:
 Gets a range of plot data for the given plot and field. More...
 
(BOOL- loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:
 Gets a range of plot data for the given plot. More...
 
(nonnull id+ nilData
 A unique marker object used in collections to indicate that the datasource returned nil. More...
 

Additional Inherited Members

- Public Class Methods inherited from CALayer
(id+ layer
 
- Public Class Methods inherited from NSObject
(id+ alloc
 
(Class+ class
 
(void) + initialize
 
(void) + load
 
(id+ new
 
- Public Class Methods inherited from <NSSecureCoding>
(BOOL+ supportsSecureCoding:
 

Detailed Description

An abstract plot class.

Each data series on the graph is represented by a plot. Data is provided by a datasource that conforms to the CPTPlotDataSource protocol.

A Core Plot plot will request its data from the datasource when it is first displayed. You can force it to load new data in several ways:

  • Call -reloadData on the graph to reload all plots.
  • Call -reloadData on the plot to reload all of the data for only that plot.
  • Call -reloadDataInIndexRange: on the plot to reload a range of data indices without changing the total number of data points.
  • Call -insertDataAtIndex:numberOfRecords: to insert new data at the given index. Any data at higher indices will be moved to make room. Only the new data will be requested from the datasource.

You can also remove data from the plot without reloading anything by using the -deleteDataInIndexRange: method.

See also
See Plots for a list of animatable properties supported by each plot type.

Method Documentation

◆ attributedTitleForLegendEntryAtIndex: [1/2]

- (nullable NSAttributedString *) attributedTitleForLegendEntryAtIndex: (NSUInteger __unused)  idx
implementation

The styled title text of a legend entry.

Parameters
idxThe index of the desired title.
Returns
The styled title of the legend entry at the requested index.

◆ attributedTitleForLegendEntryAtIndex: [2/2]

- (nullable NSAttributedString *) attributedTitleForLegendEntryAtIndex: (NSUInteger idx

◆ cacheArray:forKey:

- (void) cacheArray: (nullable NSArray *)  array
forKey: (nonnull NSString *)  key 

Copies an array of arbitrary values to the cache.

Parameters
arrayAn array of arbitrary values to cache.
keyThe key identifying the field.

◆ cacheArray:forKey:atRecordIndex:

- (void) cacheArray: (nullable NSArray *)  array
forKey: (nonnull NSString *)  key
atRecordIndex: (NSUInteger idx 

Copies an array of arbitrary values to replace a part of the cache.

Parameters
arrayAn array of arbitrary values to cache.
keyThe key identifying the field.
idxThe index of the first data point to replace.

◆ cachedArrayForKey:

- (nullable NSArray *) cachedArrayForKey: (nonnull NSString *)  key

Retrieves an array of values from the cache.

Parameters
keyThe key identifying the field.
Returns
The array of cached values.

◆ cachedDecimalForField:recordIndex:

- (NSDecimal) cachedDecimalForField: (NSUInteger fieldEnum
recordIndex: (NSUInteger idx 

Retrieves a single number from the cache.

Parameters
fieldEnumThe field enumerator identifying the field.
idxThe index of the desired data value.
Returns
The cached number or NaN if no data is cached for the requested field.

◆ cachedDoubleForField:recordIndex:

- (double) cachedDoubleForField: (NSUInteger fieldEnum
recordIndex: (NSUInteger idx 

Retrieves a single number from the cache.

Parameters
fieldEnumThe field enumerator identifying the field.
idxThe index of the desired data value.
Returns
The cached number or NaN if no data is cached for the requested field.

◆ cachedNumberForField:recordIndex:

- (nullable NSNumber *) cachedNumberForField: (NSUInteger fieldEnum
recordIndex: (NSUInteger idx 

Retrieves a single number from the cache.

Parameters
fieldEnumThe field enumerator identifying the field.
idxThe index of the desired data value.
Returns
The cached number.

◆ cachedNumbersForField:

- (nullable CPTMutableNumericData *) cachedNumbersForField: (NSUInteger fieldEnum

Retrieves an array of numbers from the cache.

Parameters
fieldEnumThe field enumerator identifying the field.
Returns
The array of cached numbers.

◆ cachedValueForKey:recordIndex:

- (nullable id) cachedValueForKey: (nonnull NSString *)  key
recordIndex: (NSUInteger idx 

Retrieves a single value from the cache.

Parameters
keyThe key identifying the field.
idxThe index of the desired data value.
Returns
The cached value or nil if no data is cached for the requested key.

◆ cacheNumbers:forField:

- (void) cacheNumbers: (nullable id numbers
forField: (NSUInteger fieldEnum 

Copies an array of numbers to the cache.

Parameters
numbersAn array of numbers to cache. Can be a CPTNumericData, NSArray, or NSData (NSData is assumed to be a c-style array of type double).
fieldEnumThe field enumerator identifying the field.

◆ cacheNumbers:forField:atRecordIndex:

- (void) cacheNumbers: (nullable id numbers
forField: (NSUInteger fieldEnum
atRecordIndex: (NSUInteger idx 

Copies an array of numbers to replace a part of the cache.

Parameters
numbersAn array of numbers to cache. Can be a CPTNumericData, NSArray, or NSData (NSData is assumed to be a c-style array of type double).
fieldEnumThe field enumerator identifying the field.
idxThe index of the first data point to replace.

◆ coordinateForFieldIdentifier: [1/2]

- (CPTCoordinate) coordinateForFieldIdentifier: (NSUInteger __unused)  field
implementation

The coordinate value that corresponds to a particular field identifier.

Parameters
fieldThe field identifier for which the corresponding coordinate is desired.
Returns
The coordinate that corresponds to a particular field identifier or CPTCoordinateNone if there is no matching coordinate.

Provided by category CPTPlot(AbstractMethods).

◆ coordinateForFieldIdentifier: [2/2]

- (CPTCoordinate) coordinateForFieldIdentifier: (NSUInteger field

Provided by category CPTPlot(AbstractMethods).

◆ dataIndexFromInteractionPoint: [1/2]

- (NSUInteger) dataIndexFromInteractionPoint: (CGPoint __unused)  point
implementation

Determines the index of the data element that is under the given point.

Parameters
pointThe coordinates of the interaction.
Returns
The index of the data point that is under the given point or NSNotFound if none was found.

Provided by category CPTPlot(AbstractMethods).

◆ dataIndexFromInteractionPoint: [2/2]

- (NSUInteger) dataIndexFromInteractionPoint: (CGPoint point

Provided by category CPTPlot(AbstractMethods).

◆ deleteDataInIndexRange:

- (void) deleteDataInIndexRange: (NSRange indexRange

Delete records in the given index range from the plot data cache.

Parameters
indexRangeThe index range of the data records to remove.

◆ drawSwatchForLegend:atIndex:inRect:inContext:

- (void) drawSwatchForLegend: (nonnull CPTLegend *)  legend
atIndex: (NSUInteger idx
inRect: (CGRect rect
inContext: (nonnull CGContextRef context 

Draws the legend swatch of a legend entry. Subclasses should call super to draw the background fill and border.

Parameters
legendThe legend being drawn.
idxThe index of the desired swatch.
rectThe bounding rectangle where the swatch should be drawn.
contextThe graphics context to draw into.

◆ fieldIdentifiers

- (nonnull CPTNumberArray *) fieldIdentifiers

Identifiers (enum values) identifying the fields.

Returns
Array of NSNumber objects for the various field identifiers.

Provided by category CPTPlot(AbstractMethods).

◆ fieldIdentifiersForCoordinate: [1/2]

- (nonnull CPTNumberArray *) fieldIdentifiersForCoordinate: (CPTCoordinate __unused)  coord
implementation

The field identifiers that correspond to a particular coordinate.

Parameters
coordThe coordinate for which the corresponding field identifiers are desired.
Returns
Array of NSNumber objects for the field identifiers.

Provided by category CPTPlot(AbstractMethods).

◆ fieldIdentifiersForCoordinate: [2/2]

- (nonnull CPTNumberArray *) fieldIdentifiersForCoordinate: (CPTCoordinate coord

Provided by category CPTPlot(AbstractMethods).

◆ initWithFrame:

- (nonnull instancetype) initWithFrame: (CGRect newFrame
implementation

Initializes a newly allocated CPTPlot object with the provided frame rectangle.

This is the designated initializer. The initialized layer will have the following properties:

Parameters
newFrameThe frame rectangle.
Returns
The initialized CPTPlot object.

Reimplemented from CPTAnnotationHostLayer.

Reimplemented in CPTPieChart, CPTTradingRangePlot, CPTRangePlot, CPTBarPlot, and CPTScatterPlot.

◆ insertDataAtIndex:numberOfRecords:

- (void) insertDataAtIndex: (NSUInteger idx
numberOfRecords: (NSUInteger numberOfRecords 

Insert records into the plot data cache at the given index.

Parameters
idxThe starting index of the new records.
numberOfRecordsThe number of records to insert.

◆ loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:

- (BOOL) loadNumbersForAllFieldsFromDataSourceInRecordIndexRange: (NSRange indexRange

Gets a range of plot data for the given plot.

Parameters
indexRangeThe range of the data indexes of interest.
Returns
Returns YES if the datasource implements the -dataForPlot:recordIndexRange: method and it returns valid data.

◆ nilData

+ (nonnull id) nilData

A unique marker object used in collections to indicate that the datasource returned nil.

◆ numberOfFields

- (NSUInteger) numberOfFields

Number of fields in a plot data record.

Returns
The number of fields.

Provided by category CPTPlot(AbstractMethods).

◆ numberOfLegendEntries

- (NSUInteger) numberOfLegendEntries

The number of legend entries provided by this plot.

Returns
The number of legend entries.

◆ numbersFromDataSourceForField:recordIndexRange:

- (nullable id) numbersFromDataSourceForField: (NSUInteger fieldEnum
recordIndexRange: (NSRange indexRange 

Gets a range of plot data for the given plot and field.

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

◆ plotRangeEnclosingCoordinate:

- (nullable CPTPlotRange *) plotRangeEnclosingCoordinate: (CPTCoordinate coord

Determines the smallest plot range that fully encloses the entire plot for a particular coordinate.

Parameters
coordThe coordinate identifier.
Returns
The plot range enclosing the data.

◆ plotRangeEnclosingField:

- (nullable CPTPlotRange *) plotRangeEnclosingField: (NSUInteger fieldEnum

Determines the smallest plot range that fully encloses the entire plot for a particular field.

Parameters
fieldEnumThe field enumerator identifying the field.
Returns
The plot range enclosing the data.

◆ plotRangeForCoordinate:

- (nullable CPTPlotRange *) plotRangeForCoordinate: (CPTCoordinate coord

Determines the smallest plot range that fully encloses the data for a particular coordinate.

Parameters
coordThe coordinate identifier.
Returns
The plot range enclosing the data.

◆ plotRangeForField:

- (nullable CPTPlotRange *) plotRangeForField: (NSUInteger fieldEnum

Determines the smallest plot range that fully encloses the data for a particular field.

Parameters
fieldEnumThe field enumerator identifying the field.
Returns
The plot range enclosing the data.

◆ pointingDeviceDownEvent:atPoint:

- (BOOL) pointingDeviceDownEvent: (nonnull CPTNativeEvent *)  event
atPoint: (CGPoint interactionPoint 
implementation

Informs the receiver that the user has started touching the screen.

If this plot has a delegate that responds to the -plot:dataLabelTouchDownAtRecordIndex: or -plot:dataLabelTouchDownAtRecordIndex:withEvent: methods, the data labels are searched to find the index of the one containing the interactionPoint. The delegate method will be called and this method returns YES if the interactionPoint is within a label. This method returns NO if the interactionPoint is too far away from all of the data labels.

Parameters
eventThe OS event.
interactionPointThe coordinates of the interaction.
Returns
Whether the event was handled or not.

Reimplemented from CPTAnnotationHostLayer.

Reimplemented in CPTPieChart, CPTTradingRangePlot, CPTRangePlot, CPTBarPlot, and CPTScatterPlot.

◆ pointingDeviceUpEvent:atPoint:

- (BOOL) pointingDeviceUpEvent: (nonnull CPTNativeEvent *)  event
atPoint: (CGPoint interactionPoint 
implementation

Informs the receiver that the user has ended touching the screen.

If this plot has a delegate that responds to the -plot:dataLabelTouchUpAtRecordIndex: or -plot:dataLabelTouchUpAtRecordIndex:withEvent: methods, the data labels are searched to find the index of the one containing the interactionPoint. The delegate method will be called and this method returns YES if the interactionPoint is within a label. This method returns NO if the interactionPoint is too far away from all of the data labels.

If the data label being released is the same as the one that was pressed (see -pointingDeviceDownEvent:atPoint: ), if the delegate responds to the -plot:dataLabelWasSelectedAtRecordIndex: and/or -plot:dataLabelWasSelectedAtRecordIndex:withEvent: methods, these will be called.

Parameters
eventThe OS event.
interactionPointThe coordinates of the interaction.
Returns
Whether the event was handled or not.

Reimplemented from CPTAnnotationHostLayer.

Reimplemented in CPTPieChart, CPTTradingRangePlot, CPTRangePlot, CPTBarPlot, and CPTScatterPlot.

◆ positionLabelAnnotation:forIndex: [1/2]

- (void) positionLabelAnnotation: (nonnull CPTPlotSpaceAnnotation *__unused)  label
forIndex: (NSUInteger __unused)  idx 
implementation

Adjusts the position of the data label annotation for the plot point at the given index.

Parameters
labelThe annotation for the data label.
idxThe data index for the label.

Provided by category CPTPlot(AbstractMethods).

◆ positionLabelAnnotation:forIndex: [2/2]

- (void) positionLabelAnnotation: (nonnull CPTPlotSpaceAnnotation *)  label
forIndex: (NSUInteger idx 

Provided by category CPTPlot(AbstractMethods).

◆ relabel

- (void) relabel

Updates the data labels in the labelIndexRange.

◆ relabelIndexRange:

- (void) relabelIndexRange: (NSRange indexRange

Marks the receiver as needing to update a range of data labels before the content is next drawn.

Parameters
indexRangeThe index range needing update.
See also
- setNeedsRelabel

◆ reloadData

- (void) reloadData

Reload all plot data, labels, and plot-specific information from the data source immediately.

◆ reloadDataIfNeeded

- (void) reloadDataIfNeeded

Reload plot data from the data source only if the data cache is out of date.

◆ reloadDataInIndexRange:

- (void) reloadDataInIndexRange: (NSRange indexRange

Reload plot data, labels, and plot-specific information in the given index range from the data source immediately.

Parameters
indexRangeThe index range to load.

◆ reloadDataLabels

- (void) reloadDataLabels

Reload all data labels from the data source immediately.

◆ reloadDataLabelsInIndexRange:

- (void) reloadDataLabelsInIndexRange: (NSRange indexRange

Reload data labels in the given index range from the data source immediately.

Parameters
indexRangeThe index range to load.

◆ reloadPlotData

- (void) reloadPlotData

Reload all plot data from the data source immediately.

◆ reloadPlotDataInIndexRange: [1/2]

- (void) reloadPlotDataInIndexRange: (NSRange __unused)  indexRange
implementation

Reload plot data in the given index range from the data source immediately.

Parameters
indexRangeThe index range to load.

◆ reloadPlotDataInIndexRange: [2/2]

- (void) reloadPlotDataInIndexRange: (NSRange indexRange

◆ repositionAllLabelAnnotations

- (void) repositionAllLabelAnnotations

Repositions all existing label annotations.

◆ setDataNeedsReloading

- (void) setDataNeedsReloading

Marks the receiver as needing the data source reloaded before the content is next drawn.

◆ setNeedsRelabel

- (void) setNeedsRelabel

Marks the receiver as needing to update all data labels before the content is next drawn.

See also
-relabelIndexRange:

◆ titleForLegendEntryAtIndex: [1/2]

- (nullable NSString *) titleForLegendEntryAtIndex: (NSUInteger __unused)  idx
implementation

The title text of a legend entry.

Parameters
idxThe index of the desired title.
Returns
The title of the legend entry at the requested index.

◆ titleForLegendEntryAtIndex: [2/2]

- (nullable NSString *) titleForLegendEntryAtIndex: (NSUInteger idx

Property Documentation

◆ adjustLabelAnchors

- (BOOL) adjustLabelAnchors
readwritenonatomicassign

If YES, data labels anchor points are adjusted automatically when the labels are positioned. If NO, data labels anchor points do not change.

◆ alignsPointsToPixels

- (BOOL) alignsPointsToPixels
readwritenonatomicassign

If YES (the default), all plot points will be aligned to device pixels when drawing.

◆ attributedTitle

- (nullable NSAttributedString *) attributedTitle
readwritenonatomiccopy

The styled title of the plot displayed in the legend.

Assigning a new value to this property also sets the value of the title property to the same string without formatting information.

◆ cachedDataCount

- (NSUInteger) cachedDataCount
readnonatomicassign

The number of data points stored in the cache.

◆ cachePrecision

- (CPTPlotCachePrecision) cachePrecision
readwritenonatomicassign

The numeric precision used to cache the plot data and perform all plot calculations. Defaults to CPTPlotCachePrecisionAuto.

◆ dataNeedsReloading

- (BOOL) dataNeedsReloading
readnonatomicassign

If YES, the plot data will be reloaded from the data source before the layer content is drawn.

◆ dataSource

- (nullable id< CPTPlotDataSource >) dataSource
readwritenonatomicweak

The data source for the plot.

◆ decimalDataType

- (CPTNumericDataType) decimalDataType
readnonatomicassign

The CPTNumericDataType used to cache plot data as NSDecimal.

◆ doubleDataType

- (CPTNumericDataType) doubleDataType
readnonatomicassign

The CPTNumericDataType used to cache plot data as double.

◆ doublePrecisionCache

- (BOOL) doublePrecisionCache
readnonatomicassign

If YES, the cache holds data of type double, otherwise it holds NSDecimal.

◆ drawLegendSwatchDecoration

- (BOOL) drawLegendSwatchDecoration
readwritenonatomicassign

If YES (the default), additional plot-specific decorations, symbols, and/or colors will be drawn on top of the legend swatch rectangle.

◆ labelField

- (NSUInteger) labelField
readwritenonatomicassign

The plot field identifier of the data field used to generate automatic labels.

◆ labelFormatter

- (nullable NSFormatter *) labelFormatter
readwritenonatomicstrong

The number formatter used to format the data labels. Set this property to nil to hide the data labels. If you need a non-numerical label, such as a date, you can use a formatter than turns the numerical plot coordinate into a string (e.g., “Jan 10, 2010”). The CPTCalendarFormatter and CPTTimeFormatter classes are useful for this purpose.

◆ labelShadow

- (nullable CPTShadow *) labelShadow
readwritenonatomicstrong

The shadow applied to each data label.

◆ labelTextStyle

- (nullable CPTTextStyle *) labelTextStyle
readwritenonatomiccopy

The text style used to draw the data labels. Set this property to nil to hide the data labels.

◆ needsRelabel

- (BOOL) needsRelabel
readnonatomicassign

If YES, the plot needs to be relabeled before the layer content is drawn.

◆ plotArea

- (nullable CPTPlotArea *) plotArea
readnonatomicassign

The plot area for the plot.

◆ plotSpace

- (nullable CPTPlotSpace *) plotSpace
readwritenonatomicstrong

The plot space for the plot.

◆ showLabels

- (BOOL) showLabels
readwritenonatomicassign

Set to NO to override all other label settings and hide the data labels. Defaults to YES.

◆ title

- (nullable NSString *) title
readwritenonatomiccopy

The title of the plot displayed in the legend.

Assigning a new value to this property also sets the value of the attributedTitle property to nil.


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