Core Plot (macOS)
Cocoa plotting framework for macOS, iOS, and tvOS
|
A two-dimensional scatter plot. More...
#import <CPTScatterPlot.h>
Public Instance Methods | |
Visible Points | |
(NSUInteger) | - indexOfVisiblePointClosestToPlotAreaPoint: |
Returns the index of the closest visible point to the point passed in. More... | |
(CGPoint) | - plotAreaPointOfVisiblePointAtIndex: |
Returns the plot area view point of a visible point. More... | |
Plot Symbols | |
(nullable CPTPlotSymbol *) | - plotSymbolForRecordIndex: |
Returns the plot symbol to use for a given index. More... | |
(void) | - reloadPlotSymbols |
Reload all plot symbols from the data source immediately. More... | |
(void) | - reloadPlotSymbolsInIndexRange: |
Reload plot symbols in the given index range from the data source immediately. More... | |
Initialization | |
(nonnull instancetype) | - initWithFrame: [implementation] |
Initializes a newly allocated CPTScatterPlot object with the provided frame rectangle. More... | |
Public Instance Methods inherited from CPTPlot | |
(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... | |
(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... | |
(NSUInteger) | - dataIndexFromInteractionPoint: |
(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: |
(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: |
(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... | |
(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: |
(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... | |
(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... | |
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 the mouse with the button pressed. More... | |
(BOOL) | - pointingDeviceCancelledEvent: [implementation] |
Informs the receiver that tracking of mouse moves 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] |
(BOOL) | - scrollWheelEvent:fromPoint:toPoint: [implementation] |
(nonnull 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: |
Public Instance Methods inherited from <NSKeyValueBindingCreation> | |
(NSArray *) | - exposedBindings |
(Class) | - valueClassForBinding: |
(void) | - bind:toObject:withKeyPath:options: |
(NSArray *) | - optionDescriptionsForBinding: |
(NSDictionary *) | - infoForBinding: |
(void) | - unbind: |
Public Instance Methods inherited from <NSCoding> | |
(id) | - initWithCoder: |
(void) | - encodeWithCoder: |
Public Instance Methods inherited from <CPTResponder> | |
(BOOL) | - scrollWheelEvent:fromPoint:toPoint: |
(Required) Informs the receiver that the user has moved the scroll wheel. More... | |
Properties | |
Appearance | |
NSNumber * | areaBaseValue |
The Y coordinate of the straight boundary of the area fill. If not a number, the area is not filled. More... | |
NSNumber * | areaBaseValue2 |
The Y coordinate of the straight boundary of the secondary area fill. If not a number, the area is not filled. More... | |
CPTScatterPlotInterpolation | interpolation |
The interpolation algorithm used for lines between data points. Default is CPTScatterPlotInterpolationLinear. More... | |
CPTScatterPlotHistogramOption | histogramOption |
The drawing style for a histogram plot line (interpolation = CPTScatterPlotInterpolationHistogram). Default is CPTScatterPlotHistogramNormal. More... | |
CPTScatterPlotCurvedInterpolationOption | curvedInterpolationOption |
The interpolation method used to generate the curved plot line (interpolation = CPTScatterPlotInterpolationCurved) Default is CPTScatterPlotCurvedInterpolationNormal. More... | |
CGFloat | curvedInterpolationCustomAlpha |
The custom alpha value used when the CPTScatterPlotCurvedInterpolationCatmullCustomAlpha interpolation is selected. Default is 0.5 . More... | |
Drawing | |
CPTLineStyle * | dataLineStyle |
The line style for the data line. If nil, the line is not drawn. More... | |
CPTPlotSymbol * | plotSymbol |
The plot symbol drawn at each point if the data source does not provide symbols. If nil, no symbol is drawn. More... | |
CPTFill * | areaFill |
The fill style for the area underneath the data line. If nil, the area is not filled. More... | |
CPTFill * | areaFill2 |
The fill style for the area above the data line. If nil, the area is not filled. More... | |
Data Line | |
CGPathRef | newDataLinePath |
The path used to draw the data line. The caller must release the returned path. More... | |
Properties inherited from CPTPlot | |
id< CPTPlotDataSource > | dataSource |
The data source for the plot. More... | |
NSString * | title |
The title of the plot displayed in the legend. More... | |
NSAttributedString * | attributedTitle |
The styled title of the plot displayed in the legend. More... | |
CPTPlotSpace * | plotSpace |
The plot space for the plot. More... | |
CPTPlotArea * | plotArea |
The plot area for the plot. More... | |
BOOL | alignsPointsToPixels |
If YES (the default), all plot points will be aligned to device pixels when drawing. More... | |
BOOL | dataNeedsReloading |
If YES, the plot data will be reloaded from the data source before the layer content is drawn. More... | |
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... | |
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... | |
CPTTextStyle * | labelTextStyle |
The text style used to draw the data labels. Set this property to nil to hide the data labels. More... | |
NSFormatter * | labelFormatter |
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... | |
CPTShadow * | labelShadow |
The shadow applied to each data label. More... | |
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... | |
Properties inherited from CPTAnnotationHostLayer | |
CPTAnnotationArray * | annotations |
An array of annotations attached to this layer. More... | |
Properties inherited from CPTLayer | |
CPTGraph * | graph |
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, NSObject > | identifier |
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... | |
CPTShadow * | shadow |
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... | |
CPTSublayerSet * | sublayersExcludedFromAutomaticLayout |
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 |
NSString * | fillMode |
float | repeatCount |
id | repeatDuration |
float | speed |
CFTimeInterval | timeOffset |
Area Fill Bands | |
CPTLimitBandArray * | areaFillBands |
An array of CPTLimitBand objects. More... | |
(void) | - addAreaFillBand: |
Add an area fill limit band. More... | |
(void) | - removeAreaFillBand: |
Remove an area fill limit band. More... | |
User Interaction | |
CGFloat | plotSymbolMarginForHitDetection |
A margin added to each side of a symbol when determining whether it has been hit. More... | |
CGFloat | plotLineMarginForHitDetection |
A margin added to each side of a plot line when determining whether it has been hit. More... | |
BOOL | allowSimultaneousSymbolAndPlotSelection |
YES if both symbol selection and line selection can happen on the same upEvent. If NO then when an upEvent occurs on a symbol only the symbol will be selected, otherwise the line will be selected if the upEvent occured on the line. More... | |
(BOOL) | - pointingDeviceDownEvent:atPoint: [implementation] |
Informs the receiver that the user has pressed the mouse button. More... | |
(BOOL) | - pointingDeviceUpEvent:atPoint: [implementation] |
Informs the receiver that the user has released the mouse button. More... | |
(BOOL) | - plotWasLineHitByInteractionPoint: [implementation] |
Additional Inherited Members | |
Public Class Methods inherited from CPTPlot | |
(nonnull id) | + nilData |
A unique marker object used in collections to indicate that the datasource returned nil. More... | |
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 <NSKeyValueBindingCreation> | |
(void) | + exposeBinding: |
Public Class Methods inherited from <NSSecureCoding> | |
(BOOL) | + supportsSecureCoding: |
A two-dimensional scatter plot.
- (void) addAreaFillBand: | (nullable CPTLimitBand *) | limitBand |
Add an area fill limit band.
The band will be drawn on top of the areaFill between the plot line and the areaBaseValue.
limitBand | The new limit band. |
- (NSUInteger) indexOfVisiblePointClosestToPlotAreaPoint: | (CGPoint) | viewPoint |
Returns the index of the closest visible point to the point passed in.
viewPoint | The reference point. |
|
implementation |
Initializes a newly allocated CPTScatterPlot object with the provided frame rectangle.
This is the designated initializer. The initialized layer will have the following properties:
NaN
NaN
0.0
4.0
0.5
newFrame | The frame rectangle. |
Reimplemented from CPTPlot.
- (CGPoint) plotAreaPointOfVisiblePointAtIndex: | (NSUInteger) | idx |
Returns the plot area view point of a visible point.
idx | The index of the point. |
- (nullable CPTPlotSymbol *) plotSymbolForRecordIndex: | (NSUInteger) | idx |
Returns the plot symbol to use for a given index.
idx | The index of the record. |
|
implementation |
Informs the receiver that the user has pressed the mouse button.
If this plot has a delegate that responds to the -scatterPlot:plotSymbolTouchDownAtRecordIndex: or -scatterPlot:plotSymbolTouchDownAtRecordIndex:withEvent: or -scatterPlot:plotSymbolWasSelectedAtRecordIndex: or -scatterPlot:plotSymbolWasSelectedAtRecordIndex:withEvent: methods, the data points are searched to find the index of the one closest to the interactionPoint
. The 'touchDown' delegate method(s) will be called and this method will return YES if the interactionPoint
is within the plotSymbolMarginForHitDetection of the closest data point. Then, if no plot symbol was hit or allowSimultaneousSymbolAndPlotSelection is YES and if this plot has a delegate that responds to the -scatterPlotDataLineTouchDown: or -scatterPlot:dataLineTouchDownWithEvent: or -scatterPlotDataLineWasSelected: or -scatterPlot:dataLineWasSelectedWithEvent: methods and the interactionPoint
falls within plotLineMarginForHitDetection points of the plot line, then the 'dataLineTouchDown' delegate method(s) will be called and this method will return YES. This method returns NO if the interactionPoint
is not within plotSymbolMarginForHitDetection points of any of the data points or within plotLineMarginForHitDetection points of the plot line.
event | The OS event. |
interactionPoint | The coordinates of the interaction. |
Reimplemented from CPTPlot.
|
implementation |
Informs the receiver that the user has released the mouse button.
If this plot has a delegate that responds to the -scatterPlot:plotSymbolTouchDownAtRecordIndex: or -scatterPlot:plotSymbolTouchDownAtRecordIndex:withEvent: or -scatterPlot:plotSymbolWasSelectedAtRecordIndex: or -scatterPlot:plotSymbolWasSelectedAtRecordIndex:withEvent: methods, the data points are searched to find the index of the one closest to the interactionPoint
. The 'touchDown' delegate method(s) will be called and this method will return YES if the interactionPoint
is within the plotSymbolMarginForHitDetection of the closest data point. Then, if no plot symbol was hit or allowSimultaneousSymbolAndPlotSelection is YES and if this plot has a delegate that responds to the -scatterPlotDataLineTouchUp: or -scatterPlot:dataLineTouchUpWithEvent: or -scatterPlotDataLineWasSelected: or -scatterPlot:dataLineWasSelectedWithEvent: methods and the interactionPoint
falls within plotLineMarginForHitDetection points of the plot line, then the 'dataLineTouchUp' delegate method(s) will be called and this method will return YES. This method returns NO if the interactionPoint
is not within plotSymbolMarginForHitDetection points of any of the data points or within plotLineMarginForHitDetection points of the plot line.
event | The OS event. |
interactionPoint | The coordinates of the interaction. |
Reimplemented from CPTPlot.
- (void) reloadPlotSymbols |
Reload all plot symbols from the data source immediately.
- (void) reloadPlotSymbolsInIndexRange: | (NSRange) | indexRange |
Reload plot symbols in the given index range from the data source immediately.
indexRange | The index range to load. |
- (void) removeAreaFillBand: | (nullable CPTLimitBand *) | limitBand |
Remove an area fill limit band.
limitBand | The limit band to be removed. |
|
readwritenonatomicassign |
|
readwritenonatomiccopy |
The fill style for the area underneath the data line. If nil, the area is not filled.
|
readwritenonatomiccopy |
The fill style for the area above the data line. If nil, the area is not filled.
|
readnonatomicassign |
An array of CPTLimitBand objects.
The limit bands are drawn between the plot line and areaBaseValue and on top of the areaFill.
|
readwritenonatomiccopy |
The line style for the data line. If nil, the line is not drawn.
|
readnonatomicassign |
The path used to draw the data line. The caller must release the returned path.
|
readwritenonatomicassign |
A margin added to each side of a plot line when determining whether it has been hit.
Default is four points to each side of the line. The margin is set in plot area view coordinates.
|
readwritenonatomiccopy |
The plot symbol drawn at each point if the data source does not provide symbols. If nil, no symbol is drawn.
|
readwritenonatomicassign |
A margin added to each side of a symbol when determining whether it has been hit.
Default is zero. The margin is set in plot area view coordinates.