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

A layer representing the actual plotting area of a graph. More...

#import <CPTPlotArea.h>

+ Inheritance diagram for CPTPlotArea:
+ Collaboration diagram for CPTPlotArea:

Public Instance Methods

Axis Set Layer Management
(void) - updateAxisSetLayersForType:
 Checks for the presence of the specified layer group and adds or removes it as needed. More...
 
(void) - setAxisSetLayersForType:
 Ensures that a group layer is set for the given layer type. More...
 
(unsigned) - sublayerIndexForAxis:layerType:
 Computes the sublayer index for the given layer type and axis. More...
 
Initialization
(nonnull instancetype) - initWithFrame: [implementation]
 Initializes a newly allocated CPTPlotArea object with the provided frame rectangle. More...
 
Layout
(void) - layoutSublayers [implementation]
 Updates the layout of all sublayers. Sublayers fill the super layer’s bounds except for the plotGroup, which will fill the receiver’s bounds. More...
 
User Interaction
(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...
 
- 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...
 
- 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

Layers
CPTGridLineGroupminorGridLineGroup
 The parent layer for all minor grid lines. More...
 
CPTGridLineGroupmajorGridLineGroup
 The parent layer for all major grid lines. More...
 
CPTAxisSetaxisSet
 The axis set. More...
 
CPTPlotGroupplotGroup
 The plot group. More...
 
CPTAxisLabelGroupaxisLabelGroup
 The parent layer for all axis labels. More...
 
CPTAxisLabelGroupaxisTitleGroup
 The parent layer for all axis titles. More...
 
Layer Ordering
CPTNumberArraytopDownLayerOrder
 An array of graph layers to be drawn in an order other than the default. More...
 
Decorations
CPTLineStyleborderLineStyle
 The line style for the layer border. If nil, the border is not drawn. More...
 
CPTFillfill
 The fill for the layer background. If nil, the layer background is not filled. More...
 
Dimensions
NSDecimal widthDecimal
 The width of the bounds as an NSDecimal value. More...
 
NSDecimal heightDecimal
 The height of the bounds as an NSDecimal value. 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
 

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 <NSKeyValueBindingCreation>
(void) + exposeBinding:
 
- Public Class Methods inherited from <NSSecureCoding>
(BOOL+ supportsSecureCoding:
 

Detailed Description

A layer representing the actual plotting area of a graph.

All plots are drawn inside this area while axes, titles, and borders may fall outside. The layers are arranged so that the graph elements are drawn in the following order:

  1. Background fill
  2. Minor grid lines
  3. Major grid lines
  4. Background border
  5. Axis lines with major and minor tick marks
  6. Plots
  7. Axis labels
  8. Axis titles

Method Documentation

◆ initWithFrame:

- (nonnull instancetype) initWithFrame: (CGRect newFrame
implementation

Initializes a newly allocated CPTPlotArea 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 CPTPlotArea object.

Reimplemented from CPTAnnotationHostLayer.

◆ layoutSublayers

- (void) layoutSublayers
implementation

Updates the layout of all sublayers. Sublayers fill the super layer’s bounds except for the plotGroup, which will fill the receiver’s bounds.

This is where we do our custom replacement for the Mac-only layout manager and autoresizing mask. Subclasses should override this method to provide a different layout of their own sublayers.

Reimplemented from CPTLayer.

◆ pointingDeviceDownEvent:atPoint:

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

Informs the receiver that the user has pressed the mouse button.

If this plot area has a delegate that responds to the -plotAreaTouchDown: and/or -plotAreaTouchDown:withEvent: methods, the delegate method will be called and this method returns YES if the interactionPoint is within the plot area bounds.

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

Reimplemented from CPTAnnotationHostLayer.

◆ pointingDeviceUpEvent:atPoint:

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

Informs the receiver that the user has released the mouse button.

If this plot area has a delegate that responds to the -plotAreaTouchUp: , -plotAreaTouchUp:withEvent: , -plotAreaWasSelected: , and/or -plotAreaWasSelected:withEvent: methods, the delegate method will be called and this method returns YES if the interactionPoint is within the plot area bounds.

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

Reimplemented from CPTAnnotationHostLayer.

◆ setAxisSetLayersForType:

- (void) setAxisSetLayersForType: (CPTGraphLayerType layerType

Ensures that a group layer is set for the given layer type.

Parameters
layerTypeThe layer type being updated.

◆ sublayerIndexForAxis:layerType:

- (unsigned) sublayerIndexForAxis: (nonnull CPTAxis *)  axis
layerType: (CPTGraphLayerType layerType 

Computes the sublayer index for the given layer type and axis.

Parameters
axisThe axis of interest.
layerTypeThe layer type being updated.
Returns
The sublayer index for the given layer type.

◆ updateAxisSetLayersForType:

- (void) updateAxisSetLayersForType: (CPTGraphLayerType layerType

Checks for the presence of the specified layer group and adds or removes it as needed.

Parameters
layerTypeThe layer type being updated.

Property Documentation

◆ axisLabelGroup

- (nullable CPTAxisLabelGroup *) axisLabelGroup
readwritenonatomicstrong

The parent layer for all axis labels.

◆ axisSet

- (nullable CPTAxisSet *) axisSet
readwritenonatomicstrong

The axis set.

◆ axisTitleGroup

- (nullable CPTAxisLabelGroup *) axisTitleGroup
readwritenonatomicstrong

The parent layer for all axis titles.

◆ borderLineStyle

- (nullable CPTLineStyle *) borderLineStyle
readwritenonatomiccopy

The line style for the layer border. If nil, the border is not drawn.

◆ fill

- (nullable CPTFill *) fill
readwritenonatomiccopy

The fill for the layer background. If nil, the layer background is not filled.

◆ heightDecimal

- (NSDecimal) heightDecimal
readnonatomicassign

The height of the bounds as an NSDecimal value.

◆ majorGridLineGroup

- (nullable CPTGridLineGroup *) majorGridLineGroup
readwritenonatomicstrong

The parent layer for all major grid lines.

◆ minorGridLineGroup

- (nullable CPTGridLineGroup *) minorGridLineGroup
readwritenonatomicstrong

The parent layer for all minor grid lines.

◆ plotGroup

- (nullable CPTPlotGroup *) plotGroup
readwritenonatomicstrong

The plot group.

◆ topDownLayerOrder

- (nullable CPTNumberArray *) topDownLayerOrder
readwritenonatomicstrong

An array of graph layers to be drawn in an order other than the default.

The array should reference the layers using the constants defined in CPTGraphLayerType. Layers should be specified in order starting from the top layer. Only the layers drawn out of the default order need be specified; all others will automatically be placed at the bottom of the view in their default order.

If this property is nil, the layers will be drawn in the default order (bottom to top):

  1. Minor grid lines
  2. Major grid lines
  3. Axis lines, including the tick marks
  4. Plots
  5. Axis labels
  6. Axis titles

Example usage:

◆ widthDecimal

- (NSDecimal) widthDecimal
readnonatomicassign

The width of the bounds as an NSDecimal value.


The documentation for this class was generated from the following files:
CPTGraphLayerTypeMajorGridLines
@ CPTGraphLayerTypeMajorGridLines
Major grid lines.
Definition: CPTGraph.h:64
CPTGraphLayerTypeAxisLabels
@ CPTGraphLayerTypeAxisLabels
Axis labels.
Definition: CPTGraph.h:67
CPTGraphLayerTypePlots
@ CPTGraphLayerTypePlots
Plots.
Definition: CPTGraph.h:66
CPTLayer::graph
CPTGraph * graph
The graph for the layer.
Definition: CPTLayer.h:87