Skip to content

Commit

Permalink
Merge pull request #5 from jonalter/TIMOB-18092
Browse files Browse the repository at this point in the history
Updating CorePlot
  • Loading branch information
jonalter committed Jan 16, 2015
2 parents 96ecea4 + 55c7018 commit fabfc5e
Show file tree
Hide file tree
Showing 94 changed files with 2,465 additions and 1,283 deletions.
24 changes: 12 additions & 12 deletions ios/Classes/TiChartsParsers.m
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,18 @@ +(CPTXYAxis*)parseAxis:(CPTCoordinate)coordinate properties:(NSDictionary*)prope
// this is done with the '#' and '0' characters (e.g. "###0.00"). Optionally, prefix and suffix strings can
// be specified. See http://unicode.org/reports/tr35/tr35-6.html#Number_Format_Patterns for details.
if (axis.labelFormatter) {
axis.labelFormatter.positiveFormat = [TiUtils stringValue:@"numberFormatPositive" properties:labelProps
def:[TiUtils stringValue:@"numberFormat" properties:labelProps def:axis.labelFormatter.positiveFormat]];
axis.labelFormatter.negativeFormat = [TiUtils stringValue:@"numberFormatNegative" properties:labelProps
def:[TiUtils stringValue:@"numberFormat" properties:labelProps def:axis.labelFormatter.negativeFormat]];
axis.labelFormatter.positivePrefix = [TiUtils stringValue:@"numberPrefixPositive" properties:labelProps
def:[TiUtils stringValue:@"numberPrefix" properties:labelProps def:axis.labelFormatter.positivePrefix]];
axis.labelFormatter.negativePrefix = [TiUtils stringValue:@"numberPrefixNegative" properties:labelProps
def:[TiUtils stringValue:@"numberPrefix" properties:labelProps def:axis.labelFormatter.negativePrefix]];
axis.labelFormatter.positiveSuffix = [TiUtils stringValue:@"numberSuffixPositive" properties:labelProps
def:[TiUtils stringValue:@"numberSuffix" properties:labelProps def:axis.labelFormatter.positiveSuffix]];
axis.labelFormatter.negativeSuffix = [TiUtils stringValue:@"numberSuffixNegative" properties:labelProps
def:[TiUtils stringValue:@"numberSuffix" properties:labelProps def:axis.labelFormatter.negativeSuffix]];
((NSNumberFormatter *) axis.labelFormatter).positiveFormat = [TiUtils stringValue:@"numberFormatPositive" properties:labelProps
def:[TiUtils stringValue:@"numberFormat" properties:labelProps def:((NSNumberFormatter *) axis.labelFormatter).positiveFormat]];
((NSNumberFormatter *) axis.labelFormatter).negativeFormat = [TiUtils stringValue:@"numberFormatNegative" properties:labelProps
def:[TiUtils stringValue:@"numberFormat" properties:labelProps def:((NSNumberFormatter *) axis.labelFormatter).negativeFormat]];
((NSNumberFormatter *) axis.labelFormatter).positivePrefix = [TiUtils stringValue:@"numberPrefixPositive" properties:labelProps
def:[TiUtils stringValue:@"numberPrefix" properties:labelProps def:((NSNumberFormatter *) axis.labelFormatter).positivePrefix]];
((NSNumberFormatter *) axis.labelFormatter).negativePrefix = [TiUtils stringValue:@"numberPrefixNegative" properties:labelProps
def:[TiUtils stringValue:@"numberPrefix" properties:labelProps def:((NSNumberFormatter *) axis.labelFormatter).negativePrefix]];
((NSNumberFormatter *) axis.labelFormatter).positiveSuffix = [TiUtils stringValue:@"numberSuffixPositive" properties:labelProps
def:[TiUtils stringValue:@"numberSuffix" properties:labelProps def:((NSNumberFormatter *) axis.labelFormatter).positiveSuffix]];
((NSNumberFormatter *) axis.labelFormatter).negativeSuffix = [TiUtils stringValue:@"numberSuffixNegative" properties:labelProps
def:[TiUtils stringValue:@"numberSuffix" properties:labelProps def:((NSNumberFormatter *) axis.labelFormatter).negativeSuffix]];
}
}
}
Expand Down
128 changes: 128 additions & 0 deletions ios/CorePlot/CorePlotHeaders/CPTAnimation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
@class CPTAnimationOperation;
@class CPTAnimationPeriod;

/**
* @brief Enumeration of animation curves.
**/
typedef enum _CPTAnimationCurve {
CPTAnimationCurveDefault, ///< Use the default animation curve.
CPTAnimationCurveLinear, ///< Linear animation curve.
CPTAnimationCurveBackIn, ///< Backing in animation curve.
CPTAnimationCurveBackOut, ///< Backing out animation curve.
CPTAnimationCurveBackInOut, ///< Backing in and out animation curve.
CPTAnimationCurveBounceIn, ///< Bounce in animation curve.
CPTAnimationCurveBounceOut, ///< Bounce out animation curve.
CPTAnimationCurveBounceInOut, ///< Bounce in and out animation curve.
CPTAnimationCurveCircularIn, ///< Circular in animation curve.
CPTAnimationCurveCircularOut, ///< Circular out animation curve.
CPTAnimationCurveCircularInOut, ///< Circular in and out animation curve.
CPTAnimationCurveElasticIn, ///< Elastic in animation curve.
CPTAnimationCurveElasticOut, ///< Elastic out animation curve.
CPTAnimationCurveElasticInOut, ///< Elastic in and out animation curve.
CPTAnimationCurveExponentialIn, ///< Exponential in animation curve.
CPTAnimationCurveExponentialOut, ///< Exponential out animation curve.
CPTAnimationCurveExponentialInOut, ///< Exponential in and out animation curve.
CPTAnimationCurveSinusoidalIn, ///< Sinusoidal in animation curve.
CPTAnimationCurveSinusoidalOut, ///< Sinusoidal out animation curve.
CPTAnimationCurveSinusoidalInOut, ///< Sinusoidal in and out animation curve.
CPTAnimationCurveCubicIn, ///< Cubic in animation curve.
CPTAnimationCurveCubicOut, ///< Cubic out animation curve.
CPTAnimationCurveCubicInOut, ///< Cubic in and out animation curve.
CPTAnimationCurveQuadraticIn, ///< Quadratic in animation curve.
CPTAnimationCurveQuadraticOut, ///< Quadratic out animation curve.
CPTAnimationCurveQuadraticInOut, ///< Quadratic in and out animation curve.
CPTAnimationCurveQuarticIn, ///< Quartic in animation curve.
CPTAnimationCurveQuarticOut, ///< Quartic out animation curve.
CPTAnimationCurveQuarticInOut, ///< Quartic in and out animation curve.
CPTAnimationCurveQuinticIn, ///< Quintic in animation curve.
CPTAnimationCurveQuinticOut, ///< Quintic out animation curve.
CPTAnimationCurveQuinticInOut ///< Quintic in and out animation curve.
}
CPTAnimationCurve;

/**
* @brief Animation delegate.
**/
@protocol CPTAnimationDelegate<NSObject>

@optional

/// @name Animation
/// @{

/** @brief @optional Informs the delegate that an animation operation started animating.
* @param operation The animation operation.
**/
-(void)animationDidStart:(CPTAnimationOperation *)operation;

/** @brief @optional Informs the delegate that an animation operation stopped after reaching its full duration.
* @param operation The animation operation.
**/
-(void)animationDidFinish:(CPTAnimationOperation *)operation;

/** @brief @optional Informs the delegate that an animation operation was stopped before reaching its full duration.
* @param operation The animation operation.
**/
-(void)animationCancelled:(CPTAnimationOperation *)operation;

/** @brief @optional Informs the delegate that the animated property is about to update.
* @param operation The animation operation.
**/
-(void)animationWillUpdate:(CPTAnimationOperation *)operation;

/** @brief @optional Informs the delegate that the animated property has been updated.
* @param operation The animation operation.
**/
-(void)animationDidUpdate:(CPTAnimationOperation *)operation;

/// @}

@end

#pragma mark -

@interface CPTAnimation : NSObject
{
@private
NSMutableArray *animationOperations;
NSMutableArray *runningAnimationOperations;
NSMutableArray *expiredAnimationOperations;
NSTimer *timer;

CGFloat timeOffset;
CPTAnimationCurve defaultAnimationCurve;
}

/// @name Time
/// @{
@property (nonatomic, readonly, assign) CGFloat timeOffset;
/// @}

/// @name Animation Curve
/// @{
@property (nonatomic, assign) CPTAnimationCurve defaultAnimationCurve;
/// @}

/// @name Animation Controller Instance
/// @{
+(CPTAnimation *)sharedInstance;
/// @}

/// @name Property Animation
/// @{
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property period:(CPTAnimationPeriod *)period animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
/// @}

/// @name Animation Management
/// @{
-(CPTAnimationOperation *)addAnimationOperation:(CPTAnimationOperation *)animationOperation;
-(void)removeAnimationOperation:(CPTAnimationOperation *)animationOperation;
-(void)removeAllAnimationOperations;
/// @}

/// @name Retrieving Animation Operations
/// @{
-(CPTAnimationOperation *)operationWithIdentifier:(id<NSCopying, NSObject>)identifier;
/// @}

@end
44 changes: 44 additions & 0 deletions ios/CorePlot/CorePlotHeaders/CPTAnimationOperation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#import "CPTAnimation.h"
#import "CPTDefinitions.h"

@class CPTAnimationPeriod;

@interface CPTAnimationOperation : NSObject {
@private
CPTAnimationPeriod *period;
CPTAnimationCurve animationCurve;

id boundObject;
SEL boundGetter;
SEL boundSetter;

__cpt_weak NSObject<CPTAnimationDelegate> *delegate;
id<NSCopying, NSObject> identifier;
NSDictionary *userInfo;
}

/// @name Animation Timing
/// @{
@property (nonatomic, retain) CPTAnimationPeriod *period;
@property (nonatomic, assign) CPTAnimationCurve animationCurve;
/// @}

/// @name Animated Property
/// @{
@property (nonatomic, retain) id boundObject;
@property (nonatomic) SEL boundGetter;
@property (nonatomic) SEL boundSetter;
/// @}

/// @name Delegate
/// @{
@property (nonatomic, cpt_weak_property) __cpt_weak NSObject<CPTAnimationDelegate> *delegate;
/// @}

/// @name Identification
/// @{
@property (nonatomic, readwrite, copy) id<NSCopying, NSObject> identifier;
@property (nonatomic, readwrite, copy) NSDictionary *userInfo;
/// @}

@end
116 changes: 116 additions & 0 deletions ios/CorePlot/CorePlotHeaders/CPTAnimationPeriod.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#import "CPTAnimation.h"

@class CPTAnimationOperation;
@class CPTPlotRange;

@interface CPTAnimationPeriod : NSObject {
@private
NSValue *startValue;
NSValue *endValue;
CGFloat duration;
CGFloat delay;
CGFloat startOffset;
}

/// @name Timing Values
/// @{
@property (nonatomic, readwrite, copy) NSValue *startValue;
@property (nonatomic, readwrite, copy) NSValue *endValue;
@property (nonatomic, readwrite) CGFloat duration;
@property (nonatomic, readwrite) CGFloat delay;
@property (nonatomic, readonly) CGFloat startOffset;
/// @}

/// @name Factory Methods
/// @{
+(id)periodWithStart:(CGFloat)aStart end:(CGFloat)anEnd duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
+(id)periodWithStartPoint:(CGPoint)aStartPoint endPoint:(CGPoint)anEndPoint duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
+(id)periodWithStartSize:(CGSize)aStartSize endSize:(CGSize)anEndSize duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
+(id)periodWithStartRect:(CGRect)aStartRect endRect:(CGRect)anEndRect duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
+(id)periodWithStartDecimal:(NSDecimal)aStartDecimal endDecimal:(NSDecimal)anEndDecimal duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
+(id)periodWithStartPlotRange:(CPTPlotRange *)aStartPlotRange endPlotRange:(CPTPlotRange *)anEndPlotRange duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
/// @}

/// @name Initialization
/// @{
-(id)initWithStart:(CGFloat)aStart end:(CGFloat)anEnd duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
-(id)initWithStartPoint:(CGPoint)aStartPoint endPoint:(CGPoint)anEndPoint duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
-(id)initWithStartSize:(CGSize)aStartSize endSize:(CGSize)anEndSize duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
-(id)initWithStartRect:(CGRect)aStartRect endRect:(CGRect)anEndRect duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
-(id)initWithStartDecimal:(NSDecimal)aStartDecimal endDecimal:(NSDecimal)anEndDecimal duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
-(id)initWithStartPlotRange:(CPTPlotRange *)aStartPlotRange endPlotRange:(CPTPlotRange *)anEndPlotRange duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay;
/// @}

@end

#pragma mark -

/** @category CPTAnimationPeriod(AbstractMethods)
* @brief CPTAnimationPeriod abstract methods—must be overridden by subclasses
**/
@interface CPTAnimationPeriod(AbstractMethods)

/// @name Initialization
/// @{
-(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter;
/// @}

/// @name Interpolation
/// @{
-(NSValue *)tweenedValueForProgress:(CGFloat)progress;
/// @}

/// @name Comparison
/// @{
-(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter;
/// @}

@end

#pragma mark -

@interface CPTAnimation(CPTAnimationPeriodAdditions)

/// @name CGFloat Property Animation
/// @{
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from:(CGFloat)from to:(CGFloat)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from:(CGFloat)from to:(CGFloat)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from:(CGFloat)from to:(CGFloat)to duration:(CGFloat)duration;
/// @}

/// @name CGPoint Property Animation
/// @{
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPoint:(CGPoint)from toPoint:(CGPoint)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPoint:(CGPoint)from toPoint:(CGPoint)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPoint:(CGPoint)from toPoint:(CGPoint)to duration:(CGFloat)duration;
/// @}

/// @name CGSize Property Animation
/// @{
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromSize:(CGSize)from toSize:(CGSize)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromSize:(CGSize)from toSize:(CGSize)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromSize:(CGSize)from toSize:(CGSize)to duration:(CGFloat)duration;
/// @}

/// @name CGRect Property Animation
/// @{
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromRect:(CGRect)from toRect:(CGRect)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromRect:(CGRect)from toRect:(CGRect)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromRect:(CGRect)from toRect:(CGRect)to duration:(CGFloat)duration;
/// @}

/// @name NSDecimal Property Animation
/// @{
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromDecimal:(NSDecimal)from toDecimal:(NSDecimal)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromDecimal:(NSDecimal)from toDecimal:(NSDecimal)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromDecimal:(NSDecimal)from toDecimal:(NSDecimal)to duration:(CGFloat)duration;
/// @}

/// @name CPTPlotRange Property Animation
/// @{
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPlotRange:(CPTPlotRange *)from toPlotRange:(CPTPlotRange *)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPlotRange:(CPTPlotRange *)from toPlotRange:(CPTPlotRange *)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject<CPTAnimationDelegate> *)delegate;
+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPlotRange:(CPTPlotRange *)from toPlotRange:(CPTPlotRange *)to duration:(CGFloat)duration;
/// @}

@end
21 changes: 11 additions & 10 deletions ios/CorePlot/CorePlotHeaders/CPTAnnotation.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#import "CPTDefinitions.h"
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>

@class CPTAnnotationHostLayer;
@class CPTLayer;

@interface CPTAnnotation : NSObject<NSCoding> {
@private
__cpt_weak CPTAnnotationHostLayer *annotationHostLayer;
CPTLayer *contentLayer;
CGPoint contentAnchorPoint;
CGPoint displacement;
CGFloat rotation;
@private
__cpt_weak CPTAnnotationHostLayer *annotationHostLayer;
CPTLayer *contentLayer;
CGPoint contentAnchorPoint;
CGPoint displacement;
CGFloat rotation;
}

@property (nonatomic, readwrite, retain) CPTLayer *contentLayer;
Expand All @@ -24,11 +22,14 @@

#pragma mark -

/** @category CPTAnnotation(AbstractMethods)
* @brief CPTAnnotation abstract methods—must be overridden by subclasses.
/** @category CPTAnnotation(AbstractMethods)
* @brief CPTAnnotation abstract methods—must be overridden by subclasses.
**/
@interface CPTAnnotation(AbstractMethods)

/// @name Layout
/// @{
-(void)positionContentLayer;
/// @}

@end
10 changes: 5 additions & 5 deletions ios/CorePlot/CorePlotHeaders/CPTAnnotationHostLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
@class CPTAnnotation;

@interface CPTAnnotationHostLayer : CPTLayer {
@private
NSMutableArray *mutableAnnotations;
@private
NSMutableArray *mutableAnnotations;
}

@property (nonatomic, readonly, retain) NSArray *annotations;

/// @name Annotations
/// @{
/// @name Annotations
/// @{
-(void)addAnnotation:(CPTAnnotation *)annotation;
-(void)removeAnnotation:(CPTAnnotation *)annotation;
-(void)removeAllAnnotations;
/// @}
/// @}

@end
Loading

0 comments on commit fabfc5e

Please sign in to comment.