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

A plot space using a two-dimensional cartesian coordinate system. More...

#import <CPTXYPlotSpace.h>

+ Inheritance diagram for CPTXYPlotSpace:
+ Collaboration diagram for CPTXYPlotSpace:

Public Instance Methods

User Interaction
(void) - cancelAnimations
 Reset the dragging state and cancel any active animations. 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- pointingDeviceDraggedEvent:atPoint: [implementation]
 Informs the receiver that the user has moved the mouse with the button pressed. More...
 
(BOOL- scrollWheelEvent:fromPoint:toPoint: [implementation]
 Informs the receiver that the user has moved the scroll wheel. More...
 
Initialization
(nonnull instancetype) - init [implementation]
 Initializes a newly allocated CPTXYPlotSpace object. More...
 
- Public Instance Methods inherited from CPTPlotSpace
(CGPoint- plotAreaViewPointForPlotPoint: [implementation]
 Converts a data point to plot area drawing coordinates. More...
 
(CGPoint- plotAreaViewPointForPlotPoint:numberOfCoordinates: [implementation]
 Converts a data point to plot area drawing coordinates. More...
 
(CGPoint- plotAreaViewPointForDoublePrecisionPlotPoint:numberOfCoordinates: [implementation]
 Converts a data point to plot area drawing coordinates. More...
 
(nullable CPTNumberArray *) - plotPointForPlotAreaViewPoint: [implementation]
 Converts a point given in plot area drawing coordinates to the data coordinate space. More...
 
(void) - plotPoint:numberOfCoordinates:forPlotAreaViewPoint: [implementation]
 Converts a point given in plot area drawing coordinates to the data coordinate space. More...
 
(void) - doublePrecisionPlotPoint:numberOfCoordinates:forPlotAreaViewPoint: [implementation]
 Converts a point given in drawing coordinates to the data coordinate space. More...
 
(CGPoint- plotAreaViewPointForEvent: [implementation]
 Converts the interaction point of an OS event to plot area drawing coordinates. More...
 
(nullable CPTNumberArray *) - plotPointForEvent: [implementation]
 Converts the interaction point of an OS event to the data coordinate space. More...
 
(void) - plotPoint:numberOfCoordinates:forEvent: [implementation]
 Converts the interaction point of an OS event to the data coordinate space. More...
 
(void) - doublePrecisionPlotPoint:numberOfCoordinates:forEvent: [implementation]
 Converts the interaction point of an OS event to the data coordinate space. More...
 
(void) - setPlotRange:forCoordinate: [implementation]
 Sets the range of values for a given coordinate. More...
 
(nullable CPTPlotRange *) - plotRangeForCoordinate: [implementation]
 Gets the range of values for a given coordinate. More...
 
(void) - setScaleType:forCoordinate: [implementation]
 Sets the scale type for a given coordinate. More...
 
(CPTScaleType- scaleTypeForCoordinate: [implementation]
 Gets the scale type for a given coordinate. More...
 
(void) - scaleToFitPlots: [implementation]
 Scales the plot ranges so that the plots just fit in the visible space. More...
 
(void) - scaleToFitEntirePlots: [implementation]
 Scales the plot ranges so that the plots just fit in the visible space. More...
 
(void) - scaleBy:aboutPoint: [implementation]
 Zooms the plot space equally in each dimension. More...
 
(void) - addCategory:forCoordinate:
 Add a new category name for the given coordinate. More...
 
(void) - removeCategory:forCoordinate:
 Removes the named category for the given coordinate. More...
 
(void) - insertCategory:forCoordinate:atIndex:
 Add a new category name for the given coordinate at the given index in the list of category names. More...
 
(void) - setCategories:forCoordinate:
 Replace all category names for the given coordinate with the names in the supplied array. More...
 
(void) - removeAllCategories
 Remove all categories for every coordinate. More...
 
(nonnull CPTStringArray *) - categoriesForCoordinate:
 Returns a list of all category names for the given coordinate. More...
 
(nullable NSString *) - categoryForCoordinate:atIndex:
 Returns the category name for the given coordinate at the given index in the list of category names. More...
 
(NSUInteger- indexOfCategory:forCoordinate:
 Returns the index of the given category name in the list of category names for the given coordinate. More...
 
(nullable instancetype) - initWithCoder:
 Returns an object initialized from data in a given unarchiver. More...
 
(BOOL- pointingDeviceCancelledEvent: [implementation]
 Informs the receiver that tracking of mouse moves has been cancelled for any reason. More...
 
(CGPoint- plotAreaViewPointForPlotPoint:
 
(CGPoint- plotAreaViewPointForPlotPoint:numberOfCoordinates:
 
(CGPoint- plotAreaViewPointForDoublePrecisionPlotPoint:numberOfCoordinates:
 
(nullable CPTNumberArray *) - plotPointForPlotAreaViewPoint:
 
(void) - plotPoint:numberOfCoordinates:forPlotAreaViewPoint:
 
(void) - doublePrecisionPlotPoint:numberOfCoordinates:forPlotAreaViewPoint:
 
(CGPoint- plotAreaViewPointForEvent:
 
(nullable CPTNumberArray *) - plotPointForEvent:
 
(void) - plotPoint:numberOfCoordinates:forEvent:
 
(void) - doublePrecisionPlotPoint:numberOfCoordinates:forEvent:
 
(void) - setPlotRange:forCoordinate:
 
(nullable CPTPlotRange *) - plotRangeForCoordinate:
 
(void) - setScaleType:forCoordinate:
 
(CPTScaleType- scaleTypeForCoordinate:
 
(void) - scaleToFitPlots:
 
(void) - scaleToFitPlots:forCoordinate:
 Scales the plot range for the given coordinate so that the plots just fit in the visible space. More...
 
(void) - scaleToFitEntirePlots:
 
(void) - scaleToFitEntirePlots:forCoordinate:
 Scales the plot range for the given coordinate so that the plots just fit in the visible space. More...
 
(void) - scaleBy:aboutPoint:
 
- 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:
 
User Interaction
- Public Instance Methods inherited from <NSCoding>
(id- initWithCoder:
 
(void) - encodeWithCoder:
 
- Public Instance Methods inherited from <CPTAnimationDelegate>
(void) - animationDidStart:
 (Optional) Informs the delegate that an animation operation started animating. More...
 
(void) - animationDidFinish:
 (Optional) Informs the delegate that an animation operation stopped after reaching its full duration. More...
 
(void) - animationCancelled:
 (Optional) Informs the delegate that an animation operation was stopped before reaching its full duration. More...
 
(void) - animationWillUpdate:
 (Optional) Informs the delegate that the animated property is about to update. More...
 
(void) - animationDidUpdate:
 (Optional) Informs the delegate that the animated property has been updated. More...
 

Properties

CPTPlotRangexRange
 The range of the x coordinate. Defaults to a range with location zero (0) and a length of one (1). More...
 
CPTPlotRangeyRange
 The range of the y coordinate. Defaults to a range with location zero (0) and a length of one (1). More...
 
CPTPlotRangeglobalXRange
 The global range of the x coordinate to which the xRange is constrained. More...
 
CPTPlotRangeglobalYRange
 The global range of the y coordinate to which the yRange is constrained. More...
 
CPTScaleType xScaleType
 The scale type of the x coordinate. Defaults to CPTScaleTypeLinear. More...
 
CPTScaleType yScaleType
 The scale type of the y coordinate. Defaults to CPTScaleTypeLinear. More...
 
BOOL allowsMomentum
 If YES, plot space scrolling in any direction slows down gradually rather than stopping abruptly. Defaults to NO. More...
 
BOOL allowsMomentumX
 If YES, plot space scrolling in the x-direction slows down gradually rather than stopping abruptly. Defaults to NO. More...
 
BOOL allowsMomentumY
 If YES, plot space scrolling in the y-direction slows down gradually rather than stopping abruptly. Defaults to NO. More...
 
CPTAnimationCurve momentumAnimationCurve
 The animation curve used to stop the motion of the plot ranges when scrolling with momentum. Defaults to CPTAnimationCurveQuadraticOut. More...
 
CPTAnimationCurve bounceAnimationCurve
 The animation curve used to return the plot range back to the global range after scrolling. Defaults to CPTAnimationCurveQuadraticOut. More...
 
CGFloat momentumAcceleration
 Deceleration in pixels/second^2 for momentum scrolling. Defaults to 2000.0. More...
 
CGFloat bounceAcceleration
 Bounce-back acceleration in pixels/second^2 when scrolled past the global range. Defaults to 3000.0. More...
 
CGFloat minimumDisplacementToDrag
 The minimum distance the interaction point must move before the event is considered a drag. Defaults to 2.0. More...
 
- Properties inherited from CPTPlotSpace
id< NSCopying, NSCoding, NSObjectidentifier
 An object used to identify the plot in collections. More...
 
BOOL allowsUserInteraction
 Determines whether user can interactively change plot range and/or zoom. More...
 
BOOL isDragging
 Returns YES when the user is actively dragging the plot space. More...
 
CPTGraphgraph
 The graph of the space. More...
 
id< CPTPlotSpaceDelegatedelegate
 The plot space delegate. More...
 
NSUInteger numberOfCoordinates
 The number of coordinate values that determine a point in the plot space. More...
 

Additional Inherited Members

- 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 plot space using a two-dimensional cartesian coordinate system.

The xRange and yRange determine the mapping between data coordinates and the screen coordinates in the plot area. The “end” of a range is the location plus its length. Note that the length of a plot range can be negative, so the end point can have a lesser value than the starting location.

The global ranges constrain the values of the xRange and yRange. Whenever the global range is set (non-nil), the corresponding plot range will be adjusted so that it fits in the global range. When a new range is set to the plot range, it will be adjusted as needed to fit in the global range. This is useful for constraining scrolling, for instance.

Method Documentation

◆ cancelAnimations

- (void) cancelAnimations

Reset the dragging state and cancel any active animations.

◆ init

- (nonnull instancetype) init
implementation

Initializes a newly allocated CPTXYPlotSpace object.

The initialized object will have the following properties:

Returns
The initialized object.

Reimplemented from CPTPlotSpace.

◆ pointingDeviceDownEvent:atPoint:

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

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

If the receiver has a delegate and the delegate handles the event, this method always returns YES. If allowsUserInteraction is NO or the graph does not have a plotArea layer, this method always returns NO. Otherwise, if the interactionPoint is within the bounds of the plotArea , a drag operation starts and this method returns YES.

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

Reimplemented from CPTPlotSpace.

◆ pointingDeviceDraggedEvent:atPoint:

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

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

If the receiver has a delegate and the delegate handles the event, this method always returns YES. If allowsUserInteraction is NO or the graph does not have a plotArea layer, this method always returns NO. Otherwise, if a drag operation commences or is in progress, the xRange and yRange are shifted to follow the drag and this method returns YES.

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

Reimplemented from CPTPlotSpace.

◆ pointingDeviceUpEvent:atPoint:

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

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

If the receiver has a delegate and the delegate handles the event, this method always returns YES. If allowsUserInteraction is NO or the graph does not have a plotArea layer, this method always returns NO. Otherwise, if a drag operation is in progress, it ends and this method returns YES.

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

Reimplemented from CPTPlotSpace.

◆ scrollWheelEvent:fromPoint:toPoint:

- (BOOL) scrollWheelEvent: (nonnull CPTNativeEvent *)  event
fromPoint: (CGPoint fromPoint
toPoint: (CGPoint toPoint 
implementation

Informs the receiver that the user has moved the scroll wheel.

If the receiver does not have a delegate, this method always returns NO. Otherwise, the -plotSpace:shouldHandleScrollWheelEvent:fromPoint:toPoint: delegate method is called. If it returns NO, this method returns YES to indicate that the event has been handled and no further processing should occur.

Parameters
eventThe OS event.
fromPointThe starting coordinates of the interaction.
toPointThe ending coordinates of the interaction.
Returns
Whether the event was handled or not.

Reimplemented from CPTPlotSpace.

Property Documentation

◆ allowsMomentum

- (BOOL) allowsMomentum
readwritenonatomicassign

If YES, plot space scrolling in any direction slows down gradually rather than stopping abruptly. Defaults to NO.

◆ allowsMomentumX

- (BOOL) allowsMomentumX
readwritenonatomicassign

If YES, plot space scrolling in the x-direction slows down gradually rather than stopping abruptly. Defaults to NO.

◆ allowsMomentumY

- (BOOL) allowsMomentumY
readwritenonatomicassign

If YES, plot space scrolling in the y-direction slows down gradually rather than stopping abruptly. Defaults to NO.

◆ bounceAcceleration

- (CGFloat) bounceAcceleration
readwritenonatomicassign

Bounce-back acceleration in pixels/second^2 when scrolled past the global range. Defaults to 3000.0.

◆ bounceAnimationCurve

- (CPTAnimationCurve) bounceAnimationCurve
readwritenonatomicassign

The animation curve used to return the plot range back to the global range after scrolling. Defaults to CPTAnimationCurveQuadraticOut.

◆ globalXRange

- (nullable CPTPlotRange *) globalXRange
readwritenonatomiccopy

The global range of the x coordinate to which the xRange is constrained.

If non-nil, the xRange and any changes to it will be adjusted so that it always fits within the globalXRange. If nil (the default), there is no constraint on x.

◆ globalYRange

- (nullable CPTPlotRange *) globalYRange
readwritenonatomiccopy

The global range of the y coordinate to which the yRange is constrained.

If non-nil, the yRange and any changes to it will be adjusted so that it always fits within the globalYRange. If nil (the default), there is no constraint on y.

◆ minimumDisplacementToDrag

- (CGFloat) minimumDisplacementToDrag
readwritenonatomicassign

The minimum distance the interaction point must move before the event is considered a drag. Defaults to 2.0.

◆ momentumAcceleration

- (CGFloat) momentumAcceleration
readwritenonatomicassign

Deceleration in pixels/second^2 for momentum scrolling. Defaults to 2000.0.

◆ momentumAnimationCurve

- (CPTAnimationCurve) momentumAnimationCurve
readwritenonatomicassign

The animation curve used to stop the motion of the plot ranges when scrolling with momentum. Defaults to CPTAnimationCurveQuadraticOut.

◆ xRange

- (nonnull CPTPlotRange *) xRange
readwritenonatomiccopy

The range of the x coordinate. Defaults to a range with location zero (0) and a length of one (1).

The location of the xRange defines the data coordinate associated with the left edge of the plot area. Similarly, the end of the xRange defines the data coordinate associated with the right edge of the plot area.

◆ xScaleType

- (CPTScaleType) xScaleType
readwritenonatomicassign

The scale type of the x coordinate. Defaults to CPTScaleTypeLinear.

◆ yRange

- (nonnull CPTPlotRange *) yRange
readwritenonatomiccopy

The range of the y coordinate. Defaults to a range with location zero (0) and a length of one (1).

The location of the yRange defines the data coordinate associated with the bottom edge of the plot area. Similarly, the end of the yRange defines the data coordinate associated with the top edge of the plot area.

◆ yScaleType

- (CPTScaleType) yScaleType
readwritenonatomicassign

The scale type of the y coordinate. Defaults to CPTScaleTypeLinear.


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