diff --git a/ios/Classes/TiChartsParsers.m b/ios/Classes/TiChartsParsers.m index 012f056..9f40872 100644 --- a/ios/Classes/TiChartsParsers.m +++ b/ios/Classes/TiChartsParsers.m @@ -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]]; } } } diff --git a/ios/CorePlot/CorePlotHeaders/CPTAnimation.h b/ios/CorePlot/CorePlotHeaders/CPTAnimation.h new file mode 100644 index 0000000..a4f21fa --- /dev/null +++ b/ios/CorePlot/CorePlotHeaders/CPTAnimation.h @@ -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 + +@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 *)delegate; +/// @} + +/// @name Animation Management +/// @{ +-(CPTAnimationOperation *)addAnimationOperation:(CPTAnimationOperation *)animationOperation; +-(void)removeAnimationOperation:(CPTAnimationOperation *)animationOperation; +-(void)removeAllAnimationOperations; +/// @} + +/// @name Retrieving Animation Operations +/// @{ +-(CPTAnimationOperation *)operationWithIdentifier:(id)identifier; +/// @} + +@end diff --git a/ios/CorePlot/CorePlotHeaders/CPTAnimationOperation.h b/ios/CorePlot/CorePlotHeaders/CPTAnimationOperation.h new file mode 100644 index 0000000..af22b16 --- /dev/null +++ b/ios/CorePlot/CorePlotHeaders/CPTAnimationOperation.h @@ -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 *delegate; + id 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 *delegate; +/// @} + +/// @name Identification +/// @{ +@property (nonatomic, readwrite, copy) id identifier; +@property (nonatomic, readwrite, copy) NSDictionary *userInfo; +/// @} + +@end diff --git a/ios/CorePlot/CorePlotHeaders/CPTAnimationPeriod.h b/ios/CorePlot/CorePlotHeaders/CPTAnimationPeriod.h new file mode 100644 index 0000000..e756513 --- /dev/null +++ b/ios/CorePlot/CorePlotHeaders/CPTAnimationPeriod.h @@ -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 *)delegate; ++(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from:(CGFloat)from to:(CGFloat)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject *)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 *)delegate; ++(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPoint:(CGPoint)from toPoint:(CGPoint)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject *)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 *)delegate; ++(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromSize:(CGSize)from toSize:(CGSize)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject *)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 *)delegate; ++(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromRect:(CGRect)from toRect:(CGRect)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject *)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 *)delegate; ++(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromDecimal:(NSDecimal)from toDecimal:(NSDecimal)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject *)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 *)delegate; ++(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPlotRange:(CPTPlotRange *)from toPlotRange:(CPTPlotRange *)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(NSObject *)delegate; ++(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPlotRange:(CPTPlotRange *)from toPlotRange:(CPTPlotRange *)to duration:(CGFloat)duration; +/// @} + +@end diff --git a/ios/CorePlot/CorePlotHeaders/CPTAnnotation.h b/ios/CorePlot/CorePlotHeaders/CPTAnnotation.h index d6ae9b4..70702c8 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTAnnotation.h +++ b/ios/CorePlot/CorePlotHeaders/CPTAnnotation.h @@ -1,17 +1,15 @@ #import "CPTDefinitions.h" -#import -#import @class CPTAnnotationHostLayer; @class CPTLayer; @interface CPTAnnotation : NSObject { - @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; @@ -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 diff --git a/ios/CorePlot/CorePlotHeaders/CPTAnnotationHostLayer.h b/ios/CorePlot/CorePlotHeaders/CPTAnnotationHostLayer.h index 841523d..d12b421 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTAnnotationHostLayer.h +++ b/ios/CorePlot/CorePlotHeaders/CPTAnnotationHostLayer.h @@ -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 diff --git a/ios/CorePlot/CorePlotHeaders/CPTAxis.h b/ios/CorePlot/CorePlotHeaders/CPTAxis.h index fa1409f..f3bb644 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTAxis.h +++ b/ios/CorePlot/CorePlotHeaders/CPTAxis.h @@ -1,11 +1,11 @@ #import "CPTDefinitions.h" #import "CPTLayer.h" #import "CPTTextStyle.h" -#import -/// @file +/// @file @class CPTAxis; +@class CPTAxisLabel; @class CPTAxisSet; @class CPTAxisTitle; @class CPTGridLines; @@ -18,21 +18,21 @@ @class CPTShadow; /** - * @brief Enumeration of labeling policies + * @brief Enumeration of labeling policies **/ typedef enum _CPTAxisLabelingPolicy { - CPTAxisLabelingPolicyNone, ///< No labels provided; user sets labels and tick locations. - CPTAxisLabelingPolicyLocationsProvided, ///< User sets tick locations; axis makes labels. - CPTAxisLabelingPolicyFixedInterval, ///< Fixed interval labeling policy. - CPTAxisLabelingPolicyAutomatic, ///< Automatic labeling policy. - CPTAxisLabelingPolicyEqualDivisions ///< Divide the plot range into equal parts. + CPTAxisLabelingPolicyNone, ///< No labels provided; user sets labels and tick locations. + CPTAxisLabelingPolicyLocationsProvided, ///< User sets tick locations; axis makes labels. + CPTAxisLabelingPolicyFixedInterval, ///< Fixed interval labeling policy. + CPTAxisLabelingPolicyAutomatic, ///< Automatic labeling policy. + CPTAxisLabelingPolicyEqualDivisions ///< Divide the plot range into equal parts. } CPTAxisLabelingPolicy; #pragma mark - /** - * @brief Axis labeling delegate. + * @brief Axis labeling delegate. **/ @protocol CPTAxisDelegate @@ -41,94 +41,139 @@ CPTAxisLabelingPolicy; /// @name Labels /// @{ -/** @brief (Optional) Determines if the axis should relabel itself now. - * @param axis The axis. - * @return YES if the axis should relabel now. +/** @brief @optional Determines if the axis should relabel itself now. + * @param axis The axis. + * @return @YES if the axis should relabel now. **/ -(BOOL)axisShouldRelabel:(CPTAxis *)axis; -/** @brief (Optional) The method is called after the axis is relabeled to allow the delegate to perform any - * necessary cleanup or further labeling actions. - * @param axis The axis. +/** @brief @optional The method is called after the axis is relabeled to allow the delegate to perform any + * necessary cleanup or further labeling actions. + * @param axis The axis. **/ -(void)axisDidRelabel:(CPTAxis *)axis; -/** @brief (Optional) This method gives the delegate a chance to create custom labels for each tick. - * It can be used with any labeling policy. Returning NO will cause the axis not - * to update the labels. It is then the delegates responsiblity to do this. - * @param axis The axis. +/** @brief @optional This method gives the delegate a chance to create custom labels for each tick. + * It can be used with any labeling policy. Returning @NO will cause the axis not + * to update the labels. It is then the delegate’s responsibility to do this. + * @param axis The axis. * @param locations The locations of the major ticks. - * @return YES if the axis class should proceed with automatic labeling. + * @return @YES if the axis class should proceed with automatic labeling. **/ -(BOOL)axis:(CPTAxis *)axis shouldUpdateAxisLabelsAtLocations:(NSSet *)locations; -/** @brief (Optional) This method gives the delegate a chance to create custom labels for each minor tick. - * It can be used with any labeling policy. Returning NO will cause the axis not - * to update the labels. It is then the delegates responsiblity to do this. - * @param axis The axis. +/** @brief @optional This method gives the delegate a chance to create custom labels for each minor tick. + * It can be used with any labeling policy. Returning @NO will cause the axis not + * to update the labels. It is then the delegate’s responsibility to do this. + * @param axis The axis. * @param locations The locations of the minor ticks. - * @return YES if the axis class should proceed with automatic labeling. + * @return @YES if the axis class should proceed with automatic labeling. **/ -(BOOL)axis:(CPTAxis *)axis shouldUpdateMinorAxisLabelsAtLocations:(NSSet *)locations; -/// @} +/// @} + +/// @name Label Selection +/// @{ + +/** @brief @optional Informs the delegate that an axis label was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param axis The axis. + * @param label The selected axis label. + **/ +-(void)axis:(CPTAxis *)axis labelWasSelected:(CPTAxisLabel *)label; + +/** @brief @optional Informs the delegate that an axis label was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param axis The axis. + * @param label The selected axis label. + * @param event The event that triggered the selection. + **/ +-(void)axis:(CPTAxis *)axis labelWasSelected:(CPTAxisLabel *)label withEvent:(CPTNativeEvent *)event; + +/** @brief @optional Informs the delegate that a minor tick axis label was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param axis The axis. + * @param label The selected minor tick axis label. + **/ +-(void)axis:(CPTAxis *)axis minorTickLabelWasSelected:(CPTAxisLabel *)label; + +/** @brief @optional Informs the delegate that a minor tick axis label was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param axis The axis. + * @param label The selected minor tick axis label. + * @param event The event that triggered the selection. + **/ +-(void)axis:(CPTAxis *)axis minorTickLabelWasSelected:(CPTAxisLabel *)label withEvent:(CPTNativeEvent *)event; + +/// @} @end #pragma mark - @interface CPTAxis : CPTLayer { - @private - CPTCoordinate coordinate; - CPTPlotSpace *plotSpace; - NSSet *majorTickLocations; - NSSet *minorTickLocations; - CGFloat majorTickLength; - CGFloat minorTickLength; - CGFloat labelOffset; - CGFloat minorTickLabelOffset; - CGFloat labelRotation; - CGFloat minorTickLabelRotation; - CPTAlignment labelAlignment; - CPTAlignment minorTickLabelAlignment; - CPTLineStyle *axisLineStyle; - CPTLineStyle *majorTickLineStyle; - CPTLineStyle *minorTickLineStyle; - CPTLineStyle *majorGridLineStyle; - CPTLineStyle *minorGridLineStyle; - CPTLineCap *axisLineCapMin; - CPTLineCap *axisLineCapMax; - NSDecimal labelingOrigin; - NSDecimal majorIntervalLength; - NSUInteger minorTicksPerInterval; - NSUInteger preferredNumberOfMajorTicks; - CPTAxisLabelingPolicy labelingPolicy; - CPTTextStyle *labelTextStyle; - CPTTextStyle *minorTickLabelTextStyle; - CPTTextStyle *titleTextStyle; - NSNumberFormatter *labelFormatter; - NSNumberFormatter *minorTickLabelFormatter; - BOOL labelFormatterChanged; - BOOL minorLabelFormatterChanged; - NSSet *axisLabels; - NSSet *minorTickAxisLabels; - CPTAxisTitle *axisTitle; - NSString *title; - CGFloat titleOffset; - CGFloat titleRotation; - NSDecimal titleLocation; - CPTSign tickDirection; - BOOL needsRelabel; - NSArray *labelExclusionRanges; - CPTPlotRange *visibleRange; - CPTPlotRange *gridLinesRange; - NSArray *alternatingBandFills; - NSMutableArray *mutableBackgroundLimitBands; - BOOL separateLayers; - CPTShadow *labelShadow; - __cpt_weak CPTPlotArea *plotArea; - __cpt_weak CPTGridLines *minorGridLines; - __cpt_weak CPTGridLines *majorGridLines; + @private + CPTCoordinate coordinate; + CPTPlotSpace *plotSpace; + NSSet *majorTickLocations; + NSSet *minorTickLocations; + CGFloat majorTickLength; + CGFloat minorTickLength; + CGFloat labelOffset; + CGFloat minorTickLabelOffset; + CGFloat labelRotation; + CGFloat minorTickLabelRotation; + CPTAlignment labelAlignment; + CPTAlignment minorTickLabelAlignment; + CPTLineStyle *axisLineStyle; + CPTLineStyle *majorTickLineStyle; + CPTLineStyle *minorTickLineStyle; + CPTLineStyle *majorGridLineStyle; + CPTLineStyle *minorGridLineStyle; + CPTLineCap *axisLineCapMin; + CPTLineCap *axisLineCapMax; + NSDecimal labelingOrigin; + NSDecimal majorIntervalLength; + NSUInteger minorTicksPerInterval; + NSUInteger preferredNumberOfMajorTicks; + CPTAxisLabelingPolicy labelingPolicy; + CPTTextStyle *labelTextStyle; + CPTTextStyle *minorTickLabelTextStyle; + CPTSign tickLabelDirection; + CPTSign minorTickLabelDirection; + CPTTextStyle *titleTextStyle; + NSFormatter *labelFormatter; + NSFormatter *minorTickLabelFormatter; + BOOL labelFormatterChanged; + BOOL minorLabelFormatterChanged; + NSSet *axisLabels; + NSSet *minorTickAxisLabels; + CPTAxisTitle *axisTitle; + NSString *title; + NSAttributedString *attributedTitle; + CGFloat titleOffset; + CGFloat titleRotation; + CPTSign titleDirection; + NSDecimal titleLocation; + CPTSign tickDirection; + BOOL needsRelabel; + NSArray *labelExclusionRanges; + CPTPlotRange *visibleRange; + CPTPlotRange *visibleAxisRange; + CPTPlotRange *gridLinesRange; + NSArray *alternatingBandFills; + NSMutableArray *mutableBackgroundLimitBands; + BOOL separateLayers; + CPTShadow *labelShadow; + CPTShadow *minorTickLabelShadow; + __cpt_weak CPTPlotArea *plotArea; + __cpt_weak CPTGridLines *minorGridLines; + __cpt_weak CPTGridLines *majorGridLines; } /// @name Axis @@ -138,9 +183,10 @@ CPTAxisLabelingPolicy; @property (nonatomic, readwrite, assign) NSDecimal labelingOrigin; @property (nonatomic, readwrite, assign) CPTSign tickDirection; @property (nonatomic, readwrite, copy) CPTPlotRange *visibleRange; +@property (nonatomic, readwrite, copy) CPTPlotRange *visibleAxisRange; @property (nonatomic, readwrite, copy) CPTLineCap *axisLineCapMin; @property (nonatomic, readwrite, copy) CPTLineCap *axisLineCapMax; -/// @} +/// @} /// @name Title /// @{ @@ -148,10 +194,12 @@ CPTAxisLabelingPolicy; @property (nonatomic, readwrite, retain) CPTAxisTitle *axisTitle; @property (nonatomic, readwrite, assign) CGFloat titleOffset; @property (nonatomic, readwrite, copy) NSString *title; +@property (nonatomic, readwrite, copy) NSAttributedString *attributedTitle; @property (nonatomic, readwrite, assign) CGFloat titleRotation; +@property (nonatomic, readwrite, assign) CPTSign titleDirection; @property (nonatomic, readwrite, assign) NSDecimal titleLocation; @property (nonatomic, readonly, assign) NSDecimal defaultTitleLocation; -/// @} +/// @} /// @name Labels /// @{ @@ -164,14 +212,17 @@ CPTAxisLabelingPolicy; @property (nonatomic, readwrite, assign) CPTAlignment minorTickLabelAlignment; @property (nonatomic, readwrite, copy) CPTTextStyle *labelTextStyle; @property (nonatomic, readwrite, copy) CPTTextStyle *minorTickLabelTextStyle; -@property (nonatomic, readwrite, retain) NSNumberFormatter *labelFormatter; -@property (nonatomic, readwrite, retain) NSNumberFormatter *minorTickLabelFormatter; +@property (nonatomic, readwrite, assign) CPTSign tickLabelDirection; +@property (nonatomic, readwrite, assign) CPTSign minorTickLabelDirection; +@property (nonatomic, readwrite, retain) NSFormatter *labelFormatter; +@property (nonatomic, readwrite, retain) NSFormatter *minorTickLabelFormatter; @property (nonatomic, readwrite, retain) NSSet *axisLabels; @property (nonatomic, readwrite, retain) NSSet *minorTickAxisLabels; @property (nonatomic, readonly, assign) BOOL needsRelabel; @property (nonatomic, readwrite, retain) NSArray *labelExclusionRanges; @property (nonatomic, readwrite, retain) CPTShadow *labelShadow; -/// @} +@property (nonatomic, readwrite, retain) CPTShadow *minorTickLabelShadow; +/// @} /// @name Major Ticks /// @{ @@ -180,7 +231,7 @@ CPTAxisLabelingPolicy; @property (nonatomic, readwrite, copy) CPTLineStyle *majorTickLineStyle; @property (nonatomic, readwrite, retain) NSSet *majorTickLocations; @property (nonatomic, readwrite, assign) NSUInteger preferredNumberOfMajorTicks; -/// @} +/// @} /// @name Minor Ticks /// @{ @@ -188,25 +239,25 @@ CPTAxisLabelingPolicy; @property (nonatomic, readwrite, assign) CGFloat minorTickLength; @property (nonatomic, readwrite, copy) CPTLineStyle *minorTickLineStyle; @property (nonatomic, readwrite, retain) NSSet *minorTickLocations; -/// @} +/// @} /// @name Grid Lines /// @{ @property (nonatomic, readwrite, copy) CPTLineStyle *majorGridLineStyle; @property (nonatomic, readwrite, copy) CPTLineStyle *minorGridLineStyle; @property (nonatomic, readwrite, copy) CPTPlotRange *gridLinesRange; -/// @} +/// @} /// @name Background Bands /// @{ @property (nonatomic, readwrite, copy) NSArray *alternatingBandFills; @property (nonatomic, readonly, retain) NSArray *backgroundLimitBands; -/// @} +/// @} /// @name Plot Space /// @{ @property (nonatomic, readwrite, retain) CPTPlotSpace *plotSpace; -/// @} +/// @} /// @name Layers /// @{ @@ -215,7 +266,12 @@ CPTAxisLabelingPolicy; @property (nonatomic, readonly, cpt_weak_property) __cpt_weak CPTGridLines *minorGridLines; @property (nonatomic, readonly, cpt_weak_property) __cpt_weak CPTGridLines *majorGridLines; @property (nonatomic, readonly, retain) CPTAxisSet *axisSet; -/// @} +/// @} + +/// @name Title +/// @{ +-(void)updateAxisTitle; +/// @} /// @name Labels /// @{ @@ -223,43 +279,43 @@ CPTAxisLabelingPolicy; -(void)setNeedsRelabel; -(void)updateMajorTickLabels; -(void)updateMinorTickLabels; -/// @} +/// @} /// @name Ticks /// @{ -(NSSet *)filteredMajorTickLocations:(NSSet *)allLocations; -(NSSet *)filteredMinorTickLocations:(NSSet *)allLocations; -/// @} +/// @} /// @name Background Bands /// @{ -(void)addBackgroundLimitBand:(CPTLimitBand *)limitBand; -(void)removeBackgroundLimitBand:(CPTLimitBand *)limitBand; -/// @} +/// @} @end #pragma mark - -/** @category CPTAxis(AbstractMethods) - * @brief CPTAxis abstract methods—must be overridden by subclasses +/** @category CPTAxis(AbstractMethods) + * @brief CPTAxis abstract methods—must be overridden by subclasses **/ @interface CPTAxis(AbstractMethods) /// @name Coordinate Space Conversions /// @{ -(CGPoint)viewPointForCoordinateDecimalNumber:(NSDecimal)coordinateDecimalNumber; -/// @} +/// @} /// @name Grid Lines /// @{ -(void)drawGridLinesInContext:(CGContextRef)context isMajor:(BOOL)major; -/// @} +/// @} /// @name Background Bands /// @{ -(void)drawBackgroundBandsInContext:(CGContextRef)context; -(void)drawBackgroundLimitsInContext:(CGContextRef)context; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTAxisLabel.h b/ios/CorePlot/CorePlotHeaders/CPTAxisLabel.h index 9c52b0c..8428701 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTAxisLabel.h +++ b/ios/CorePlot/CorePlotHeaders/CPTAxisLabel.h @@ -1,16 +1,15 @@ #import "CPTDefinitions.h" -#import @class CPTLayer; @class CPTTextStyle; @interface CPTAxisLabel : NSObject { - @private - CPTLayer *contentLayer; - CGFloat offset; - CGFloat rotation; - CPTAlignment alignment; - NSDecimal tickLocation; + @private + CPTLayer *contentLayer; + CGFloat offset; + CGFloat rotation; + CPTAlignment alignment; + NSDecimal tickLocation; } @property (nonatomic, readwrite, retain) CPTLayer *contentLayer; @@ -23,12 +22,12 @@ /// @{ -(id)initWithText:(NSString *)newText textStyle:(CPTTextStyle *)style; -(id)initWithContentLayer:(CPTLayer *)layer; -/// @} +/// @} /// @name Layout /// @{ -(void)positionRelativeToViewPoint:(CGPoint)point forCoordinate:(CPTCoordinate)coordinate inDirection:(CPTSign)direction; -(void)positionBetweenViewPoint:(CGPoint)firstPoint andViewPoint:(CGPoint)secondPoint forCoordinate:(CPTCoordinate)coordinate inDirection:(CPTSign)direction; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTAxisLabelGroup.h b/ios/CorePlot/CorePlotHeaders/CPTAxisLabelGroup.h index eb19f37..0b98256 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTAxisLabelGroup.h +++ b/ios/CorePlot/CorePlotHeaders/CPTAxisLabelGroup.h @@ -1,5 +1,4 @@ #import "CPTLayer.h" -#import @interface CPTAxisLabelGroup : CPTLayer { } diff --git a/ios/CorePlot/CorePlotHeaders/CPTAxisSet.h b/ios/CorePlot/CorePlotHeaders/CPTAxisSet.h index 57d590b..6edf6d1 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTAxisSet.h +++ b/ios/CorePlot/CorePlotHeaders/CPTAxisSet.h @@ -1,20 +1,32 @@ #import "CPTLayer.h" -#import +@class CPTAxis; @class CPTLineStyle; @interface CPTAxisSet : CPTLayer { - @private - NSArray *axes; - CPTLineStyle *borderLineStyle; + @private + NSArray *axes; + CPTLineStyle *borderLineStyle; } +/// @name Axes +/// @{ @property (nonatomic, readwrite, retain) NSArray *axes; +/// @} + +/// @name Drawing +/// @{ @property (nonatomic, readwrite, copy) CPTLineStyle *borderLineStyle; +/// @} -/// @name Labels -/// @{ +/// @name Labels +/// @{ -(void)relabelAxes; -/// @} +/// @} + +/// @name Axes +/// @{ +-(CPTAxis *)axisForCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger)idx; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTAxisTitle.h b/ios/CorePlot/CorePlotHeaders/CPTAxisTitle.h index 81370b6..935f32f 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTAxisTitle.h +++ b/ios/CorePlot/CorePlotHeaders/CPTAxisTitle.h @@ -1,5 +1,4 @@ #import "CPTAxisLabel.h" -#import @interface CPTAxisTitle : CPTAxisLabel { } diff --git a/ios/CorePlot/CorePlotHeaders/CPTBarPlot.h b/ios/CorePlot/CorePlotHeaders/CPTBarPlot.h index b5bca37..27d2951 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTBarPlot.h +++ b/ios/CorePlot/CorePlotHeaders/CPTBarPlot.h @@ -1,8 +1,7 @@ #import "CPTDefinitions.h" #import "CPTPlot.h" -#import -/// @file +/// @file @class CPTLineStyle; @class CPTMutableNumericData; @@ -14,121 +13,179 @@ @class CPTTextLayer; @class CPTTextStyle; -/// @ingroup plotBindingsBarPlot +/// @ingroup plotBindingsBarPlot /// @{ extern NSString *const CPTBarPlotBindingBarLocations; extern NSString *const CPTBarPlotBindingBarTips; extern NSString *const CPTBarPlotBindingBarBases; -/// @} +extern NSString *const CPTBarPlotBindingBarFills; +extern NSString *const CPTBarPlotBindingBarLineStyles; +/// @} /** - * @brief Enumeration of bar plot data source field types + * @brief Enumeration of bar plot data source field types **/ typedef enum _CPTBarPlotField { - CPTBarPlotFieldBarLocation, ///< Bar location on independent coordinate axis. - CPTBarPlotFieldBarTip, ///< Bar tip value. - CPTBarPlotFieldBarBase ///< Bar base (used only if @link CPTBarPlot::barBasesVary barBasesVary @endlink is YES). + CPTBarPlotFieldBarLocation, ///< Bar location on independent coordinate axis. + CPTBarPlotFieldBarTip, ///< Bar tip value. + CPTBarPlotFieldBarBase ///< Bar base (used only if @link CPTBarPlot::barBasesVary barBasesVary @endlink is YES). } CPTBarPlotField; #pragma mark - /** - * @brief A bar plot data source. + * @brief A bar plot data source. **/ @protocol CPTBarPlotDataSource @optional -/// @name Bar Style +/// @name Bar Style /// @{ -/** @brief (Optional) Gets a bar fill for the given bar plot. - * @param barPlot The bar plot. - * @param index The data index of interest. - * @return The bar fill for the bar with the given index. If the data source returns nil, the default fill is used. - * If the data source returns an NSNull object, no fill is drawn. +/** @brief @optional Gets an array of bar fills for the given bar plot. + * @param barPlot The bar plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of bar fills. **/ --(CPTFill *)barFillForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)index; +-(NSArray *)barFillsForBarPlot:(CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets a bar fill for the given bar plot. + * This method will not be called if + * @link CPTBarPlotDataSource::barFillsForBarPlot:recordIndexRange: -barFillsForBarPlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param barPlot The bar plot. + * @param idx The data index of interest. + * @return The bar fill for the bar with the given index. If the data source returns @nil, the default fill is used. + * If the data source returns an NSNull object, no fill is drawn. + **/ +-(CPTFill *)barFillForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx; -/** @brief (Optional) Gets a bar line style for the given bar plot. - * @param barPlot The bar plot. - * @param index The data index of interest. - * @return The bar line style for the bar with the given index. If the data source returns nil, the default line style is used. - * If the data source returns an NSNull object, no line is drawn. +/** @brief @optional Gets an array of bar line styles for the given bar plot. + * @param barPlot The bar plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of line styles. + **/ +-(NSArray *)barLineStylesForBarPlot:(CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets a bar line style for the given bar plot. + * This method will not be called if + * @link CPTBarPlotDataSource::barLineStylesForBarPlot:recordIndexRange: -barLineStylesForBarPlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param barPlot The bar plot. + * @param idx The data index of interest. + * @return The bar line style for the bar with the given index. If the data source returns @nil, the default line style is used. + * If the data source returns an NSNull object, no line is drawn. **/ --(CPTLineStyle *)barLineStyleForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)index; +-(CPTLineStyle *)barLineStyleForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx; -/// @} +/// @} /// @name Legends /// @{ -/** @brief (Optional) Gets the legend title for the given bar plot bar. - * @param barPlot The bar plot. - * @param index The data index of interest. - * @return The title text for the legend entry for the point with the given index. +/** @brief @optional Gets the legend title for the given bar plot bar. + * @param barPlot The bar plot. + * @param idx The data index of interest. + * @return The title text for the legend entry for the point with the given index. + **/ +-(NSString *)legendTitleForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx; + +/** @brief @optional Gets the styled legend title for the given bar plot bar. + * @param barPlot The bar plot. + * @param idx The data index of interest. + * @return The styled title text for the legend entry for the point with the given index. **/ --(NSString *)legendTitleForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)index; +-(NSAttributedString *)attributedLegendTitleForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx; -/// @} +/// @} @end #pragma mark - /** - * @brief Bar plot delegate. + * @brief Bar plot delegate. **/ -@protocol CPTBarPlotDelegate +@protocol CPTBarPlotDelegate @optional -/// @name Point Selection +/// @name Point Selection /// @{ -/** @brief (Optional) Informs delegate that a point was touched. - * @param plot The scatter plot. - * @param index Index of touched point +/** @brief @optional Informs the delegate that a bar was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The bar plot. + * @param idx The index of the + * @if MacOnly clicked bar. @endif + * @if iOSOnly touched bar. @endif **/ --(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index; +-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx; + +/** @brief @optional Informs the delegate that a bar was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The bar plot. + * @param idx The index of the + * @if MacOnly clicked bar. @endif + * @if iOSOnly touched bar. @endif + * @param event The event that triggered the selection. + **/ +-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; -/// @} +/// @} @end #pragma mark - @interface CPTBarPlot : CPTPlot { - @private - CPTLineStyle *lineStyle; - CPTFill *fill; - NSDecimal barWidth; - CGFloat barWidthScale; - NSDecimal barOffset; - CGFloat barOffsetScale; - CGFloat barCornerRadius; - NSDecimal baseValue; - BOOL barsAreHorizontal; - BOOL barBasesVary; - BOOL barWidthsAreInViewCoordinates; - CPTPlotRange *plotRange; + @private + CPTLineStyle *lineStyle; + CPTFill *fill; + NSDecimal barWidth; + CGFloat barWidthScale; + NSDecimal barOffset; + CGFloat barOffsetScale; + CGFloat barCornerRadius; + CGFloat barBaseCornerRadius; + NSDecimal baseValue; + BOOL barsAreHorizontal; + BOOL barBasesVary; + BOOL barWidthsAreInViewCoordinates; + CPTPlotRange *plotRange; } +/// @name Appearance +/// @{ @property (nonatomic, readwrite, assign) BOOL barWidthsAreInViewCoordinates; @property (nonatomic, readwrite, assign) NSDecimal barWidth; @property (nonatomic, readwrite, assign) CGFloat barWidthScale; @property (nonatomic, readwrite, assign) NSDecimal barOffset; @property (nonatomic, readwrite, assign) CGFloat barOffsetScale; @property (nonatomic, readwrite, assign) CGFloat barCornerRadius; -@property (nonatomic, readwrite, copy) CPTLineStyle *lineStyle; -@property (nonatomic, readwrite, copy) CPTFill *fill; +@property (nonatomic, readwrite, assign) CGFloat barBaseCornerRadius; @property (nonatomic, readwrite, assign) BOOL barsAreHorizontal; @property (nonatomic, readwrite, assign) NSDecimal baseValue; @property (nonatomic, readwrite, assign) BOOL barBasesVary; @property (nonatomic, readwrite, copy) CPTPlotRange *plotRange; +/// @} + +/// @name Drawing +/// @{ +@property (nonatomic, readwrite, copy) CPTLineStyle *lineStyle; +@property (nonatomic, readwrite, copy) CPTFill *fill; +/// @} /// @name Factory Methods /// @{ +(CPTBarPlot *)tubularBarPlotWithColor:(CPTColor *)color horizontalBars:(BOOL)horizontal; -/// @} +/// @} + +/// @name Data Ranges +/// @{ +-(CPTPlotRange *)plotRangeEnclosingBars; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTBorderedLayer.h b/ios/CorePlot/CorePlotHeaders/CPTBorderedLayer.h index 8b0ad67..2028a9d 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTBorderedLayer.h +++ b/ios/CorePlot/CorePlotHeaders/CPTBorderedLayer.h @@ -1,16 +1,29 @@ #import "CPTAnnotationHostLayer.h" -#import @class CPTLineStyle; @class CPTFill; @interface CPTBorderedLayer : CPTAnnotationHostLayer { - @private - CPTLineStyle *borderLineStyle; - CPTFill *fill; + @private + CPTLineStyle *borderLineStyle; + CPTFill *fill; + BOOL inLayout; } +/// @name Drawing +/// @{ @property (nonatomic, readwrite, copy) CPTLineStyle *borderLineStyle; @property (nonatomic, readwrite, copy) CPTFill *fill; +/// @} + +/// @name Layout +/// @{ +@property (nonatomic, readwrite) BOOL inLayout; +/// @} + +/// @name Drawing +/// @{ +-(void)renderBorderedLayerAsVectorInContext:(CGContextRef)context; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTCalendarFormatter.h b/ios/CorePlot/CorePlotHeaders/CPTCalendarFormatter.h new file mode 100644 index 0000000..1050b60 --- /dev/null +++ b/ios/CorePlot/CorePlotHeaders/CPTCalendarFormatter.h @@ -0,0 +1,19 @@ +@interface CPTCalendarFormatter : NSNumberFormatter { + @private + NSDateFormatter *dateFormatter; + NSDate *referenceDate; + NSCalendar *referenceCalendar; + NSCalendarUnit referenceCalendarUnit; +} + +@property (nonatomic, readwrite, retain) NSDateFormatter *dateFormatter; +@property (nonatomic, readwrite, copy) NSDate *referenceDate; +@property (nonatomic, readwrite, copy) NSCalendar *referenceCalendar; +@property (nonatomic, readwrite, assign) NSCalendarUnit referenceCalendarUnit; + +/// @name Initialization +/// @{ +-(id)initWithDateFormatter:(NSDateFormatter *)aDateFormatter; +/// @} + +@end diff --git a/ios/CorePlot/CorePlotHeaders/CPTColor.h b/ios/CorePlot/CorePlotHeaders/CPTColor.h index db93fb7..0823ead 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTColor.h +++ b/ios/CorePlot/CorePlotHeaders/CPTColor.h @@ -1,12 +1,10 @@ -#import -#import - @interface CPTColor : NSObject { - @private - CGColorRef cgColor; + @private + CGColorRef cgColor; } @property (nonatomic, readonly, assign) CGColorRef cgColor; +@property (nonatomic, readonly, getter = isOpaque) BOOL opaque; /// @name Factory Methods /// @{ @@ -29,7 +27,7 @@ +(CPTColor *)colorWithCGColor:(CGColorRef)newCGColor; +(CPTColor *)colorWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; +(CPTColor *)colorWithGenericGray:(CGFloat)gray; -/// @} +/// @} /// @name Initialization /// @{ @@ -37,6 +35,6 @@ -(id)initWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; -(CPTColor *)colorWithAlphaComponent:(CGFloat)alpha; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTColorSpace.h b/ios/CorePlot/CorePlotHeaders/CPTColorSpace.h index ac89b30..80df697 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTColorSpace.h +++ b/ios/CorePlot/CorePlotHeaders/CPTColorSpace.h @@ -1,9 +1,6 @@ -#import -#import - @interface CPTColorSpace : NSObject { - @private - CGColorSpaceRef cgColorSpace; + @private + CGColorSpaceRef cgColorSpace; } @property (nonatomic, readonly, assign) CGColorSpaceRef cgColorSpace; @@ -11,11 +8,11 @@ /// @name Factory Methods /// @{ +(CPTColorSpace *)genericRGBSpace; -/// @} +/// @} /// @name Initialization /// @{ -(id)initWithCGColorSpace:(CGColorSpaceRef)colorSpace; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTConstraints.h b/ios/CorePlot/CorePlotHeaders/CPTConstraints.h index e6885d7..484be04 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTConstraints.h +++ b/ios/CorePlot/CorePlotHeaders/CPTConstraints.h @@ -1,6 +1,3 @@ -#import -#import - @interface CPTConstraints : NSObject { } @@ -9,30 +6,30 @@ +(CPTConstraints *)constraintWithLowerOffset:(CGFloat)newOffset; +(CPTConstraints *)constraintWithUpperOffset:(CGFloat)newOffset; +(CPTConstraints *)constraintWithRelativeOffset:(CGFloat)newOffset; -/// @} +/// @} /// @name Initialization /// @{ -(id)initWithLowerOffset:(CGFloat)newOffset; -(id)initWithUpperOffset:(CGFloat)newOffset; -(id)initWithRelativeOffset:(CGFloat)newOffset; -/// @} +/// @} @end -/** @category CPTConstraints(AbstractMethods) - * @brief CPTConstraints abstract methods—must be overridden by subclasses +/** @category CPTConstraints(AbstractMethods) + * @brief CPTConstraints abstract methods—must be overridden by subclasses **/ @interface CPTConstraints(AbstractMethods) /// @name Comparison /// @{ -(BOOL)isEqualToConstraint:(CPTConstraints *)otherConstraint; -/// @} +/// @} /// @name Position /// @{ -(CGFloat)positionForLowerBound:(CGFloat)lowerBound upperBound:(CGFloat)upperBound; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTDataSourceTestCase.h b/ios/CorePlot/CorePlotHeaders/CPTDataSourceTestCase.h new file mode 100644 index 0000000..f038a88 --- /dev/null +++ b/ios/CorePlot/CorePlotHeaders/CPTDataSourceTestCase.h @@ -0,0 +1,26 @@ +#import "CPTTestCase.h" + +#import "CPTPlot.h" + +@class CPTMutablePlotRange; + +@interface CPTDataSourceTestCase : CPTTestCase { + @private + NSArray *xData, *yData; + NSMutableArray *plots; + + NSUInteger nRecords; +} + +@property (copy, readwrite) NSArray *xData; +@property (copy, readwrite) NSArray *yData; +@property (assign, readwrite) NSUInteger nRecords; +@property (retain, readonly) CPTMutablePlotRange *xRange; +@property (retain, readonly) CPTMutablePlotRange *yRange; +@property (retain, readwrite) NSMutableArray *plots; + +-(void)buildData; + +-(void)addPlot:(CPTPlot *)newPlot; + +@end diff --git a/ios/CorePlot/CorePlotHeaders/CPTDefinitions.h b/ios/CorePlot/CorePlotHeaders/CPTDefinitions.h index 3881d50..ff05b25 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTDefinitions.h +++ b/ios/CorePlot/CorePlotHeaders/CPTDefinitions.h @@ -1,24 +1,26 @@ -#import -#import - #import #import /// @file /** - * @def CPT_SDK_SUPPORTS_WEAK - * @brief Defined as 1 if the compiler and active SDK support weak references, 0 otherwise. + * @def CPT_SDK_SUPPORTS_WEAK + * @hideinitializer + * @brief Defined as @num{1} if the compiler and active SDK support weak references, @num{0} otherwise. **/ /** - * @def __cpt_weak - * @brief A custom definition for ARC weak references that falls back to unsafe unretained values on older platforms. + * @def __cpt_weak + * @hideinitializer + * @brief A custom definition for automatic reference counting (ARC) weak references that falls back to + * __unsafe_unretained values on older platforms. **/ /** - * @def cpt_weak_property - * @brief A custom definition for ARC weak properties that falls back to assign on older platforms. + * @def cpt_weak_property + * @hideinitializer + * @brief A custom definition for automatic reference counting (ARC) weak properties that falls back to + * assign on older platforms. **/ // This is based on Ryan Petrich's ZWRCompatibility: https://github.com/rpetrich/ZWRCompatibility @@ -32,7 +34,7 @@ #endif #if CPT_SDK_SUPPORTS_WEAK -#define __cpt_weak __weak +#define __cpt_weak __weak #define cpt_weak_property weak #else #if __clang__ && (__clang_major__ >= 3) @@ -43,94 +45,153 @@ #define cpt_weak_property assign #endif +// Deprecated method attribute + +/** + * @def cpt_deprecated + * @hideinitializer + * @brief Marks a method declaration as deprecated. + **/ + +#define cpt_deprecated __attribute__( (deprecated) ) + +// Type safety defines + +/** + * @def CPTFloat + * @hideinitializer + * @param x The number to cast. + * @brief Casts a number to @ref CGFloat. + **/ +#define CPTFloat(x) ( (CGFloat)(x) ) + +/** + * @def CPTPointMake + * @hideinitializer + * @param x The x-coordinate of the point. + * @param y The y-coordinate of the point. + * @brief A replacement for @ref CGPointMake(), casting each parameter to @ref CGFloat. + **/ +#define CPTPointMake(x, y) CGPointMake( (CGFloat)(x), (CGFloat)(y) ) + +/** + * @def CPTSizeMake + * @hideinitializer + * @param w The width of the size. + * @param h The height of the size. + * @brief A replacement for @ref CGSizeMake(), casting each parameter to @ref CGFloat. + **/ +#define CPTSizeMake(w, h) CGSizeMake( (CGFloat)(w), (CGFloat)(h) ) + +/** + * @def CPTRectMake + * @hideinitializer + * @param x The x-coordinate of the rectangle. + * @param y The y-coordinate of the rectangle. + * @param w The width of the rectangle. + * @param h The height of the rectangle. + * @brief A replacement for @ref CGRectMake(), casting each parameter to @ref CGFloat. + **/ +#define CPTRectMake(x, y, w, h) CGRectMake( (CGFloat)(x), (CGFloat)(y), (CGFloat)(w), (CGFloat)(h) ) + +/** + * @def CPTRectInset + * @hideinitializer + * @param rect The rectangle to offset. + * @param dx The x-offset. + * @param dy The y-offset. + * @brief A replacement for @ref CGRectInset(), casting each offset parameter to @ref CGFloat. + **/ +#define CPTRectInset(rect, dx, dy) CGRectInset( rect, (CGFloat)(dx), (CGFloat)(dy) ) + /** - * @brief Enumeration of numeric types + * @brief Enumeration of numeric types **/ typedef enum _CPTNumericType { - CPTNumericTypeInteger, ///< Integer - CPTNumericTypeFloat, ///< Float - CPTNumericTypeDouble ///< Double + CPTNumericTypeInteger, ///< Integer + CPTNumericTypeFloat, ///< Float + CPTNumericTypeDouble ///< Double } CPTNumericType; /** - * @brief Enumeration of error bar types + * @brief Enumeration of error bar types **/ typedef enum _CPTErrorBarType { - CPTErrorBarTypeCustom, ///< Custom error bars - CPTErrorBarTypeConstantRatio, ///< Constant ratio error bars - CPTErrorBarTypeConstantValue ///< Constant value error bars + CPTErrorBarTypeCustom, ///< Custom error bars + CPTErrorBarTypeConstantRatio, ///< Constant ratio error bars + CPTErrorBarTypeConstantValue ///< Constant value error bars } CPTErrorBarType; /** - * @brief Enumeration of axis scale types + * @brief Enumeration of axis scale types **/ typedef enum _CPTScaleType { - CPTScaleTypeLinear, ///< Linear axis scale - CPTScaleTypeLog, ///< Logarithmic axis scale - CPTScaleTypeAngular, ///< Angular axis scale (not implemented) - CPTScaleTypeDateTime, ///< Date/time axis scale (not implemented) - CPTScaleTypeCategory ///< Category axis scale (not implemented) + CPTScaleTypeLinear, ///< Linear axis scale + CPTScaleTypeLog, ///< Logarithmic axis scale + CPTScaleTypeAngular, ///< Angular axis scale (not implemented) + CPTScaleTypeDateTime, ///< Date/time axis scale (not implemented) + CPTScaleTypeCategory ///< Category axis scale (not implemented) } CPTScaleType; /** - * @brief Enumeration of axis coordinates + * @brief Enumeration of axis coordinates **/ typedef enum _CPTCoordinate { - CPTCoordinateX = 0, ///< X axis - CPTCoordinateY = 1, ///< Y axis - CPTCoordinateZ = 2 ///< Z axis + CPTCoordinateX = 0, ///< X axis + CPTCoordinateY = 1, ///< Y axis + CPTCoordinateZ = 2 ///< Z axis } CPTCoordinate; /** - * @brief RGBA color for gradients + * @brief RGBA color for gradients **/ typedef struct _CPTRGBAColor { - CGFloat red; ///< The red component (0 ≤ red ≤ 1). - CGFloat green; ///< The green component (0 ≤ green ≤ 1). - CGFloat blue; ///< The blue component (0 ≤ blue ≤ 1). - CGFloat alpha; ///< The alpha component (0 ≤ alpha ≤ 1). + CGFloat red; ///< The red component (0 ≤ @par{red} ≤ 1). + CGFloat green; ///< The green component (0 ≤ @par{green} ≤ 1). + CGFloat blue; ///< The blue component (0 ≤ @par{blue} ≤ 1). + CGFloat alpha; ///< The alpha component (0 ≤ @par{alpha} ≤ 1). } CPTRGBAColor; /** - * @brief Enumeration of label positioning offset directions + * @brief Enumeration of label positioning offset directions **/ typedef enum _CPTSign { - CPTSignNone = 0, ///< No offset - CPTSignPositive = +1, ///< Positive offset - CPTSignNegative = -1 ///< Negative offset + CPTSignNone = 0, ///< No offset + CPTSignPositive = +1, ///< Positive offset + CPTSignNegative = -1 ///< Negative offset } CPTSign; /** - * @brief Locations around the edge of a rectangle. + * @brief Locations around the edge of a rectangle. **/ typedef enum _CPTRectAnchor { - CPTRectAnchorBottomLeft, ///< The bottom left corner - CPTRectAnchorBottom, ///< The bottom center - CPTRectAnchorBottomRight, ///< The bottom right corner - CPTRectAnchorLeft, ///< The left middle - CPTRectAnchorRight, ///< The right middle - CPTRectAnchorTopLeft, ///< The top left corner - CPTRectAnchorTop, ///< The top center - CPTRectAnchorTopRight, ///< The top right - CPTRectAnchorCenter ///< The center of the rect + CPTRectAnchorBottomLeft, ///< The bottom left corner + CPTRectAnchorBottom, ///< The bottom center + CPTRectAnchorBottomRight, ///< The bottom right corner + CPTRectAnchorLeft, ///< The left middle + CPTRectAnchorRight, ///< The right middle + CPTRectAnchorTopLeft, ///< The top left corner + CPTRectAnchorTop, ///< The top center + CPTRectAnchorTopRight, ///< The top right + CPTRectAnchorCenter ///< The center of the rect } CPTRectAnchor; /** - * @brief Label and constraint alignment constants. + * @brief Label and constraint alignment constants. **/ typedef enum _CPTAlignment { - CPTAlignmentLeft, ///< Align horizontally to the left side. - CPTAlignmentCenter, ///< Align horizontally to the center. - CPTAlignmentRight, ///< Align horizontally to the right side. - CPTAlignmentTop, ///< Align vertically to the top. - CPTAlignmentMiddle, ///< Align vertically to the middle. - CPTAlignmentBottom ///< Align vertically to the bottom. + CPTAlignmentLeft, ///< Align horizontally to the left side. + CPTAlignmentCenter, ///< Align horizontally to the center. + CPTAlignmentRight, ///< Align horizontally to the right side. + CPTAlignmentTop, ///< Align vertically to the top. + CPTAlignmentMiddle, ///< Align vertically to the middle. + CPTAlignmentBottom ///< Align vertically to the bottom. } CPTAlignment; diff --git a/ios/CorePlot/CorePlotHeaders/CPTDerivedXYGraph.h b/ios/CorePlot/CorePlotHeaders/CPTDerivedXYGraph.h new file mode 100644 index 0000000..a2c1e13 --- /dev/null +++ b/ios/CorePlot/CorePlotHeaders/CPTDerivedXYGraph.h @@ -0,0 +1,6 @@ +#import "CPTXYGraph.h" + +@interface CPTDerivedXYGraph : CPTXYGraph { +} + +@end diff --git a/ios/CorePlot/CorePlotHeaders/CPTExceptions.h b/ios/CorePlot/CorePlotHeaders/CPTExceptions.h index 7d262d4..c7d22e3 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTExceptions.h +++ b/ios/CorePlot/CorePlotHeaders/CPTExceptions.h @@ -1,5 +1,3 @@ -#import - /// @file /// @name Custom Exception Identifiers diff --git a/ios/CorePlot/CorePlotHeaders/CPTFill.h b/ios/CorePlot/CorePlotHeaders/CPTFill.h index 01ddbe7..25359a5 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTFill.h +++ b/ios/CorePlot/CorePlotHeaders/CPTFill.h @@ -1,6 +1,3 @@ -#import -#import - @class CPTGradient; @class CPTImage; @class CPTColor; @@ -13,26 +10,28 @@ +(CPTFill *)fillWithColor:(CPTColor *)aColor; +(CPTFill *)fillWithGradient:(CPTGradient *)aGradient; +(CPTFill *)fillWithImage:(CPTImage *)anImage; -/// @} +/// @} /// @name Initialization /// @{ -(id)initWithColor:(CPTColor *)aColor; -(id)initWithGradient:(CPTGradient *)aGradient; -(id)initWithImage:(CPTImage *)anImage; -/// @} +/// @} @end -/** @category CPTFill(AbstractMethods) - * @brief CPTFill abstract methods—must be overridden by subclasses +/** @category CPTFill(AbstractMethods) + * @brief CPTFill abstract methods—must be overridden by subclasses **/ @interface CPTFill(AbstractMethods) +@property (nonatomic, readonly, getter = isOpaque) BOOL opaque; + /// @name Drawing /// @{ --(void)fillRect:(CGRect)theRect inContext:(CGContextRef)theContext; --(void)fillPathInContext:(CGContextRef)theContext; -/// @} +-(void)fillRect:(CGRect)rect inContext:(CGContextRef)context; +-(void)fillPathInContext:(CGContextRef)context; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTFunctionDataSource.h b/ios/CorePlot/CorePlotHeaders/CPTFunctionDataSource.h new file mode 100644 index 0000000..4fa8d76 --- /dev/null +++ b/ios/CorePlot/CorePlotHeaders/CPTFunctionDataSource.h @@ -0,0 +1,42 @@ +#import "CPTPlot.h" + +@class CPTMutablePlotRange; +@class CPTPlotRange; +@class CPTPlotSpace; + +/// @file + +/** + * @brief A function called to generate plot data in a CPTFunctionDataSource datasource. + **/ +typedef double (*CPTDataSourceFunction)(double); + +@interface CPTFunctionDataSource : NSObject { + @private + __cpt_weak CPTPlot *dataPlot; + CPTDataSourceFunction dataSourceFunction; + CGFloat resolution; + double cachedStep; + NSUInteger dataCount; + NSUInteger cachedCount; + CPTMutablePlotRange *cachedPlotRange; + CPTPlotRange *dataRange; +} + +@property (nonatomic, readonly) CPTDataSourceFunction dataSourceFunction; +@property (nonatomic, readonly, cpt_weak_property) __cpt_weak CPTPlot *dataPlot; + +@property (nonatomic, readwrite) CGFloat resolution; +@property (nonatomic, readwrite, retain) CPTPlotRange *dataRange; + +/// @name Factory Methods +/// @{ ++(id)dataSourceForPlot:(CPTPlot *)plot withFunction:(CPTDataSourceFunction)function; +/// @} + +/// @name Initialization +/// @{ +-(id)initForPlot:(CPTPlot *)plot withFunction:(CPTDataSourceFunction)function; +/// @} + +@end diff --git a/ios/CorePlot/CorePlotHeaders/CPTGradient.h b/ios/CorePlot/CorePlotHeaders/CPTGradient.h index 981575d..6436d1a 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTGradient.h +++ b/ios/CorePlot/CorePlotHeaders/CPTGradient.h @@ -4,35 +4,34 @@ /// @file #import "CPTDefinitions.h" -#import /** - * @brief A structure representing one node in a linked list of RGBA colors. + * @brief A structure representing one node in a linked list of RGBA colors. **/ typedef struct _CPTGradientElement { - CPTRGBAColor color; ///< Color - CGFloat position; ///< Gradient position (0 ≤ position ≤ 1) + CPTRGBAColor color; ///< Color + CGFloat position; ///< Gradient position (0 ≤ @par{position} ≤ 1) - struct _CPTGradientElement *nextElement; ///< Pointer to the next CPTGradientElement in the list (last element == NULL) + struct _CPTGradientElement *nextElement; ///< Pointer to the next CPTGradientElement in the list (last element == @NULL) } CPTGradientElement; /** - * @brief Enumeration of blending modes + * @brief Enumeration of blending modes **/ typedef enum _CPTBlendingMode { - CPTLinearBlendingMode, ///< Linear blending mode - CPTChromaticBlendingMode, ///< Chromatic blending mode - CPTInverseChromaticBlendingMode ///< Inverse chromatic blending mode + CPTLinearBlendingMode, ///< Linear blending mode + CPTChromaticBlendingMode, ///< Chromatic blending mode + CPTInverseChromaticBlendingMode ///< Inverse chromatic blending mode } CPTGradientBlendingMode; /** - * @brief Enumeration of gradient types + * @brief Enumeration of gradient types **/ typedef enum _CPTGradientType { - CPTGradientTypeAxial, ///< Axial gradient - CPTGradientTypeRadial ///< Radial gradient + CPTGradientTypeAxial, ///< Axial gradient + CPTGradientTypeRadial ///< Radial gradient } CPTGradientType; @@ -40,18 +39,35 @@ CPTGradientType; @class CPTColor; @interface CPTGradient : NSObject { - @private - CPTColorSpace *colorspace; - CPTGradientElement *elementList; - CPTGradientBlendingMode blendingMode; - CGFunctionRef gradientFunction; - CGFloat angle; // angle in degrees - CPTGradientType gradientType; + @private + CPTColorSpace *colorspace; + CPTGradientElement *elementList; + CPTGradientBlendingMode blendingMode; + CGFunctionRef gradientFunction; + CGFloat angle; // angle in degrees + CPTGradientType gradientType; + CGPoint startAnchor; + CGPoint endAnchor; } +@property (nonatomic, readonly, getter = isOpaque) BOOL opaque; + +/// @name Gradient Type +/// @{ @property (nonatomic, readonly, assign) CPTGradientBlendingMode blendingMode; -@property (nonatomic, readwrite, assign) CGFloat angle; @property (nonatomic, readwrite, assign) CPTGradientType gradientType; +/// @} + +/// @name Axial Gradients +/// @{ +@property (nonatomic, readwrite, assign) CGFloat angle; +/// @} + +/// @name Radial Gradients +/// @{ +@property (nonatomic, readwrite, assign) CGPoint startAnchor; +@property (nonatomic, readwrite, assign) CGPoint endAnchor; +/// @} /// @name Factory Methods /// @{ @@ -72,7 +88,7 @@ CPTGradientType; +(CPTGradient *)rainbowGradient; +(CPTGradient *)hydrogenSpectrumGradient; -/// @} +/// @} /// @name Modification /// @{ @@ -80,21 +96,21 @@ CPTGradientType; -(CPTGradient *)gradientWithBlendingMode:(CPTGradientBlendingMode)mode; -(CPTGradient *)addColorStop:(CPTColor *)color atPosition:(CGFloat)position; // positions given relative to [0,1] --(CPTGradient *)removeColorStopAtIndex:(NSUInteger)index; +-(CPTGradient *)removeColorStopAtIndex:(NSUInteger)idx; -(CPTGradient *)removeColorStopAtPosition:(CGFloat)position; -/// @} +/// @} /// @name Information /// @{ --(CGColorRef)newColorStopAtIndex:(NSUInteger)index; +-(CGColorRef)newColorStopAtIndex:(NSUInteger)idx; -(CGColorRef)newColorAtPosition:(CGFloat)position; -/// @} +/// @} /// @name Drawing /// @{ -(void)drawSwatchInRect:(CGRect)rect inContext:(CGContextRef)context; -(void)fillRect:(CGRect)rect inContext:(CGContextRef)context; -(void)fillPathInContext:(CGContextRef)context; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTGraph.h b/ios/CorePlot/CorePlotHeaders/CPTGraph.h index 6d1a183..7f7bb5f 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTGraph.h +++ b/ios/CorePlot/CorePlotHeaders/CPTGraph.h @@ -5,6 +5,7 @@ /// @file @class CPTAxisSet; +@class CPTGraphHostingView; @class CPTLegend; @class CPTPlot; @class CPTPlotAreaFrame; @@ -16,51 +17,59 @@ /// @name Graph /// @{ -/** @brief Notification sent by various objects to tell the graph it should redraw itself. - * @ingroup notification +/** @brief Notification sent by various objects to tell the graph it should redraw itself. + * @ingroup notification **/ extern NSString *const CPTGraphNeedsRedrawNotification; -/// @} +/// @} /** - * @brief Enumeration of graph layers. + * @brief Enumeration of graph layers. **/ typedef enum _CPTGraphLayerType { - CPTGraphLayerTypeMinorGridLines, ///< Minor grid lines. - CPTGraphLayerTypeMajorGridLines, ///< Major grid lines. - CPTGraphLayerTypeAxisLines, ///< Axis lines. - CPTGraphLayerTypePlots, ///< Plots. - CPTGraphLayerTypeAxisLabels, ///< Axis labels. - CPTGraphLayerTypeAxisTitles ///< Axis titles. + CPTGraphLayerTypeMinorGridLines, ///< Minor grid lines. + CPTGraphLayerTypeMajorGridLines, ///< Major grid lines. + CPTGraphLayerTypeAxisLines, ///< Axis lines. + CPTGraphLayerTypePlots, ///< Plots. + CPTGraphLayerTypeAxisLabels, ///< Axis labels. + CPTGraphLayerTypeAxisTitles ///< Axis titles. } CPTGraphLayerType; #pragma mark - @interface CPTGraph : CPTBorderedLayer { - @private - CPTPlotAreaFrame *plotAreaFrame; - NSMutableArray *plots; - NSMutableArray *plotSpaces; - NSString *title; - CPTTextStyle *titleTextStyle; - CPTRectAnchor titlePlotAreaFrameAnchor; - CGPoint titleDisplacement; - CPTLayerAnnotation *titleAnnotation; - CPTLegend *legend; - CPTLayerAnnotation *legendAnnotation; - CPTRectAnchor legendAnchor; - CGPoint legendDisplacement; + @private + __cpt_weak CPTGraphHostingView *hostingView; + CPTPlotAreaFrame *plotAreaFrame; + NSMutableArray *plots; + NSMutableArray *plotSpaces; + NSString *title; + NSAttributedString *attributedTitle; + CPTTextStyle *titleTextStyle; + CPTRectAnchor titlePlotAreaFrameAnchor; + CGPoint titleDisplacement; + CPTLayerAnnotation *titleAnnotation; + CPTLegend *legend; + CPTLayerAnnotation *legendAnnotation; + CPTRectAnchor legendAnchor; + CGPoint legendDisplacement; } +/// @name Hosting View +/// @{ +@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTGraphHostingView *hostingView; +/// @} + /// @name Title /// @{ @property (nonatomic, readwrite, copy) NSString *title; +@property (nonatomic, readwrite, copy) NSAttributedString *attributedTitle; @property (nonatomic, readwrite, copy) CPTTextStyle *titleTextStyle; @property (nonatomic, readwrite, assign) CGPoint titleDisplacement; @property (nonatomic, readwrite, assign) CPTRectAnchor titlePlotAreaFrameAnchor; -/// @} +/// @} /// @name Layers /// @{ @@ -68,27 +77,27 @@ CPTGraphLayerType; @property (nonatomic, readwrite, retain) CPTPlotAreaFrame *plotAreaFrame; @property (nonatomic, readonly, retain) CPTPlotSpace *defaultPlotSpace; @property (nonatomic, readwrite, retain) NSArray *topDownLayerOrder; -/// @} +/// @} /// @name Legend /// @{ @property (nonatomic, readwrite, retain) CPTLegend *legend; @property (nonatomic, readwrite, assign) CPTRectAnchor legendAnchor; @property (nonatomic, readwrite, assign) CGPoint legendDisplacement; -/// @} +/// @} /// @name Data Source /// @{ -(void)reloadData; -(void)reloadDataIfNeeded; -/// @} +/// @} /// @name Retrieving Plots /// @{ -(NSArray *)allPlots; --(CPTPlot *)plotAtIndex:(NSUInteger)index; +-(CPTPlot *)plotAtIndex:(NSUInteger)idx; -(CPTPlot *)plotWithIdentifier:(id)identifier; -/// @} +/// @} /// @name Adding and Removing Plots /// @{ @@ -96,22 +105,22 @@ CPTGraphLayerType; -(void)addPlot:(CPTPlot *)plot toPlotSpace:(CPTPlotSpace *)space; -(void)removePlot:(CPTPlot *)plot; -(void)removePlotWithIdentifier:(id)identifier; --(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)index; --(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)index intoPlotSpace:(CPTPlotSpace *)space; -/// @} +-(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx; +-(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx intoPlotSpace:(CPTPlotSpace *)space; +/// @} /// @name Retrieving Plot Spaces /// @{ -(NSArray *)allPlotSpaces; --(CPTPlotSpace *)plotSpaceAtIndex:(NSUInteger)index; +-(CPTPlotSpace *)plotSpaceAtIndex:(NSUInteger)idx; -(CPTPlotSpace *)plotSpaceWithIdentifier:(id)identifier; -/// @} +/// @} /// @name Adding and Removing Plot Spaces /// @{ -(void)addPlotSpace:(CPTPlotSpace *)space; -(void)removePlotSpace:(CPTPlotSpace *)plotSpace; -/// @} +/// @} /// @name Themes /// @{ @@ -122,8 +131,8 @@ CPTGraphLayerType; #pragma mark - -/** @category CPTGraph(AbstractFactoryMethods) - * @brief CPTGraph abstract methods—must be overridden by subclasses +/** @category CPTGraph(AbstractFactoryMethods) + * @brief CPTGraph abstract methods—must be overridden by subclasses **/ @interface CPTGraph(AbstractFactoryMethods) diff --git a/ios/CorePlot/CorePlotHeaders/CPTGraphHostingView.h b/ios/CorePlot/CorePlotHeaders/CPTGraphHostingView.h index 7da25d4..f8d9719 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTGraphHostingView.h +++ b/ios/CorePlot/CorePlotHeaders/CPTGraphHostingView.h @@ -1,14 +1,13 @@ #import "CPTDefinitions.h" -#import @class CPTGraph; @interface CPTGraphHostingView : UIView { - @protected - CPTGraph *hostedGraph; - BOOL collapsesLayers; - BOOL allowPinchScaling; - __cpt_weak id pinchGestureRecognizer; + @private + CPTGraph *hostedGraph; + BOOL collapsesLayers; + BOOL allowPinchScaling; + __cpt_weak UIPinchGestureRecognizer *pinchGestureRecognizer; } @property (nonatomic, readwrite, retain) CPTGraph *hostedGraph; diff --git a/ios/CorePlot/CorePlotHeaders/CPTGridLineGroup.h b/ios/CorePlot/CorePlotHeaders/CPTGridLineGroup.h index 2803687..561bc8e 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTGridLineGroup.h +++ b/ios/CorePlot/CorePlotHeaders/CPTGridLineGroup.h @@ -3,12 +3,12 @@ @class CPTPlotArea; @interface CPTGridLineGroup : CPTLayer { - @private - __cpt_weak CPTPlotArea *plotArea; - BOOL major; + @private + __cpt_weak CPTPlotArea *plotArea; + BOOL major; } -@property (nonatomic, readwrite, assign) __cpt_weak CPTPlotArea *plotArea; +@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTPlotArea *plotArea; @property (nonatomic, readwrite) BOOL major; @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTGridLines.h b/ios/CorePlot/CorePlotHeaders/CPTGridLines.h index 2519491..2d312db 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTGridLines.h +++ b/ios/CorePlot/CorePlotHeaders/CPTGridLines.h @@ -1,15 +1,14 @@ #import "CPTLayer.h" -#import @class CPTAxis; @interface CPTGridLines : CPTLayer { - @private - __cpt_weak CPTAxis *axis; - BOOL major; + @private + __cpt_weak CPTAxis *axis; + BOOL major; } -@property (nonatomic, readwrite, assign) __cpt_weak CPTAxis *axis; +@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTAxis *axis; @property (nonatomic, readwrite) BOOL major; @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTImage.h b/ios/CorePlot/CorePlotHeaders/CPTImage.h index 506d6a6..fda339a 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTImage.h +++ b/ios/CorePlot/CorePlotHeaders/CPTImage.h @@ -1,36 +1,34 @@ -#import -#import - @interface CPTImage : NSObject { - @private - CGImageRef image; - CGFloat scale; - BOOL tiled; - BOOL tileAnchoredToContext; + @private + CGImageRef image; + CGFloat scale; + BOOL tiled; + BOOL tileAnchoredToContext; } @property (nonatomic, readwrite, assign) CGImageRef image; @property (nonatomic, readwrite, assign) CGFloat scale; @property (nonatomic, readwrite, assign, getter = isTiled) BOOL tiled; @property (nonatomic, readwrite, assign) BOOL tileAnchoredToContext; +@property (nonatomic, readonly, getter = isOpaque) BOOL opaque; /// @name Factory Methods /// @{ +(CPTImage *)imageWithCGImage:(CGImageRef)anImage scale:(CGFloat)newScale; +(CPTImage *)imageWithCGImage:(CGImageRef)anImage; +(CPTImage *)imageForPNGFile:(NSString *)path; -/// @} +/// @} /// @name Initialization /// @{ -(id)initWithCGImage:(CGImageRef)anImage scale:(CGFloat)newScale; -(id)initWithCGImage:(CGImageRef)anImage; -(id)initForPNGFile:(NSString *)path; -/// @} +/// @} /// @name Drawing /// @{ -(void)drawInRect:(CGRect)rect inContext:(CGContextRef)context; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTLayer.h b/ios/CorePlot/CorePlotHeaders/CPTLayer.h index 3d0d04f..8a3a30a 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTLayer.h +++ b/ios/CorePlot/CorePlotHeaders/CPTLayer.h @@ -1,25 +1,34 @@ #import "CPTDefinitions.h" #import "CPTResponder.h" -#import #import @class CPTGraph; @class CPTShadow; +/// @name Layout +/// @{ + +/** @brief Notification sent by all layers when the layer @link CALayer::bounds bounds @endlink change. + * @ingroup notification + **/ +extern NSString *const CPTLayerBoundsDidChangeNotification; + +/// @} + @interface CPTLayer : CALayer { - @private - CGFloat paddingLeft; - CGFloat paddingTop; - CGFloat paddingRight; - CGFloat paddingBottom; - BOOL masksToBorder; - CPTShadow *shadow; - BOOL renderingRecursively; - BOOL useFastRendering; - __cpt_weak CPTGraph *graph; - CGPathRef outerBorderPath; - CGPathRef innerBorderPath; - id identifier; + @private + CGFloat paddingLeft; + CGFloat paddingTop; + CGFloat paddingRight; + CGFloat paddingBottom; + BOOL masksToBorder; + CPTShadow *shadow; + BOOL renderingRecursively; + BOOL useFastRendering; + __cpt_weak CPTGraph *graph; + CGPathRef outerBorderPath; + CGPathRef innerBorderPath; + id identifier; } /// @name Graph @@ -33,14 +42,15 @@ @property (nonatomic, readwrite) CGFloat paddingTop; @property (nonatomic, readwrite) CGFloat paddingRight; @property (nonatomic, readwrite) CGFloat paddingBottom; -/// @} +/// @} /// @name Drawing /// @{ -@property (readwrite, assign) CGFloat contentsScale; +@property (readwrite) CGFloat contentsScale; @property (nonatomic, readonly, assign) BOOL useFastRendering; @property (nonatomic, readwrite, copy) CPTShadow *shadow; -/// @} +@property (nonatomic, readonly) CGSize shadowMargin; +/// @} /// @name Masking /// @{ @@ -49,22 +59,22 @@ @property (nonatomic, readwrite, assign) CGPathRef innerBorderPath; @property (nonatomic, readonly, assign) CGPathRef maskingPath; @property (nonatomic, readonly, assign) CGPathRef sublayerMaskingPath; -/// @} +/// @} /// @name Identification /// @{ @property (nonatomic, readwrite, copy) id identifier; -/// @} +/// @} /// @name Layout /// @{ @property (readonly) NSSet *sublayersExcludedFromAutomaticLayout; -/// @} +/// @} /// @name Initialization /// @{ -(id)initWithFrame:(CGRect)newFrame; -/// @} +/// @} /// @name Drawing /// @{ @@ -72,38 +82,47 @@ -(void)recursivelyRenderInContext:(CGContextRef)context; -(void)layoutAndRenderInContext:(CGContextRef)context; -(NSData *)dataForPDFRepresentationOfLayer; -/// @} +/// @} /// @name Masking /// @{ -(void)applySublayerMaskToContext:(CGContextRef)context forSublayer:(CPTLayer *)sublayer withOffset:(CGPoint)offset; -(void)applyMaskToContext:(CGContextRef)context; -/// @} +/// @} /// @name Layout /// @{ -(void)pixelAlign; -(void)sublayerMarginLeft:(CGFloat *)left top:(CGFloat *)top right:(CGFloat *)right bottom:(CGFloat *)bottom; -/// @} +/// @} /// @name Information /// @{ -(void)logLayers; -/// @} +/// @} @end -/// @cond -// for MacOS 10.6 SDK compatibility +/// @cond #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE #else -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 +// for MacOS 10.6 SDK compatibility +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 @interface CALayer(CPTExtensions) @property (readwrite) CGFloat contentsScale; +@end +#endif + +// for MacOS 10.5 SDK compatibility +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 +@interface CALayer(CPTExtensions2) + ++(BOOL)needsDisplayForKey:(NSString *)aKey; + @end #endif #endif -/// @endcond +/// @endcond diff --git a/ios/CorePlot/CorePlotHeaders/CPTLayerAnnotation.h b/ios/CorePlot/CorePlotHeaders/CPTLayerAnnotation.h index 70d081e..0736c8d 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTLayerAnnotation.h +++ b/ios/CorePlot/CorePlotHeaders/CPTLayerAnnotation.h @@ -1,15 +1,14 @@ #import "CPTAnnotation.h" #import "CPTDefinitions.h" -#import @class CPTConstraints; @interface CPTLayerAnnotation : CPTAnnotation { - @private - __cpt_weak CPTLayer *anchorLayer; - CPTConstraints *xConstraints; - CPTConstraints *yConstraints; - CPTRectAnchor rectAnchor; + @private + __cpt_weak CPTLayer *anchorLayer; + CPTConstraints *xConstraints; + CPTConstraints *yConstraints; + CPTRectAnchor rectAnchor; } @property (nonatomic, readonly, cpt_weak_property) __cpt_weak CPTLayer *anchorLayer; diff --git a/ios/CorePlot/CorePlotHeaders/CPTLegend.h b/ios/CorePlot/CorePlotHeaders/CPTLegend.h index fc73325..98452d5 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTLegend.h +++ b/ios/CorePlot/CorePlotHeaders/CPTLegend.h @@ -1,81 +1,151 @@ #import "CPTBorderedLayer.h" -#import /// @file +@class CPTFill; @class CPTLegend; +@class CPTLineStyle; @class CPTPlot; @class CPTTextStyle; /// @name Legend /// @{ -/** @brief Notification sent by plots to tell the legend it should redraw itself. - * @ingroup notification +/** @brief Notification sent by plots to tell the legend it should redraw itself. + * @ingroup notification **/ extern NSString *const CPTLegendNeedsRedrawForPlotNotification; -/** @brief Notification sent by plots to tell the legend it should update its layout and redraw itself. - * @ingroup notification +/** @brief Notification sent by plots to tell the legend it should update its layout and redraw itself. + * @ingroup notification **/ extern NSString *const CPTLegendNeedsLayoutForPlotNotification; -/** @brief Notification sent by plots to tell the legend it should reload all legend entries. - * @ingroup notification +/** @brief Notification sent by plots to tell the legend it should reload all legend entries. + * @ingroup notification **/ extern NSString *const CPTLegendNeedsReloadEntriesForPlotNotification; -/// @} +/// @} /** - * @brief Axis labeling delegate. + * @brief Legend delegate. **/ @protocol CPTLegendDelegate +@optional + /// @name Drawing /// @{ -/** @brief (Required) This method gives the delegate a chance to draw custom swatches for each legend entry. +/** @brief @optional This method gives the delegate a chance to provide a background fill for each legend entry. + * @param legend The legend. + * @param idx The zero-based index of the legend entry for the given plot. + * @param plot The plot. + * @return The fill for the legend entry background or @nil to use the default @link CPTLegend::entryFill entryFill @endlink . + **/ +-(CPTFill *)legend:(CPTLegend *)legend fillForEntryAtIndex:(NSUInteger)idx forPlot:(CPTPlot *)plot; + +/** @brief @optional This method gives the delegate a chance to provide a border line style for each legend entry. + * @param legend The legend. + * @param idx The zero-based index of the legend entry for the given plot. + * @param plot The plot. + * @return The line style for the legend entry border or @nil to use the default @link CPTLegend::entryBorderLineStyle entryBorderLineStyle @endlink . + **/ +-(CPTLineStyle *)legend:(CPTLegend *)legend lineStyleForEntryAtIndex:(NSUInteger)idx forPlot:(CPTPlot *)plot; + +/** @brief @optional This method gives the delegate a chance to provide a custom swatch fill for each legend entry. + * @param legend The legend. + * @param idx The zero-based index of the legend entry for the given plot. + * @param plot The plot. + * @return The fill for the legend swatch or @nil to use the default @link CPTLegend::swatchFill swatchFill @endlink . + **/ +-(CPTFill *)legend:(CPTLegend *)legend fillForSwatchAtIndex:(NSUInteger)idx forPlot:(CPTPlot *)plot; + +/** @brief @optional This method gives the delegate a chance to provide a custom swatch border line style for each legend entry. + * @param legend The legend. + * @param idx The zero-based index of the legend entry for the given plot. + * @param plot The plot. + * @return The line style for the legend swatch border or @nil to use the default @link CPTLegend::swatchBorderLineStyle swatchBorderLineStyle @endlink . + **/ +-(CPTLineStyle *)legend:(CPTLegend *)legend lineStyleForSwatchAtIndex:(NSUInteger)idx forPlot:(CPTPlot *)plot; + +/** @brief @optional This method gives the delegate a chance to draw custom swatches for each legend entry. * - * The "swatch" is the graphical part of the legend entry, usually accompanied by a text title - * that will be drawn by the legend. Returning NO will cause the legend to not draw the default - * legend graphics. It is then the delegate's responsiblity to do this. - * @param legend The legend. - * @param index The zero-based index of the legend entry for the given plot. - * @param plot The plot. - * @param rect The bounding rectangle to use when drawing the swatch. - * @param context The graphics context to draw into. - * @return YES if the legend should draw the default swatch or NO if the delegate handled the drawing. + * The "swatch" is the graphical part of the legend entry, usually accompanied by a text title + * that will be drawn by the legend. Returning @NO will cause the legend to not draw the default + * legend graphics. It is then the delegate’s responsibility to do this. + * @param legend The legend. + * @param idx The zero-based index of the legend entry for the given plot. + * @param plot The plot. + * @param rect The bounding rectangle to use when drawing the swatch. + * @param context The graphics context to draw into. + * @return @YES if the legend should draw the default swatch or @NO if the delegate handled the drawing. + **/ +-(BOOL)legend:(CPTLegend *)legend shouldDrawSwatchAtIndex:(NSUInteger)idx forPlot:(CPTPlot *)plot inRect:(CGRect)rect inContext:(CGContextRef)context; + +/// @} + +/// @name Legend Entry Selection +/// @{ + +/** @brief @optional Informs the delegate that the swatch or label of a legend entry was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param legend The legend. + * @param plot The plot associated with the selected legend entry. + * @param idx The index of the + * @if MacOnly clicked legend entry. @endif + * @if iOSOnly touched legend entry. @endif **/ --(BOOL)legend:(CPTLegend *)legend shouldDrawSwatchAtIndex:(NSUInteger)index forPlot:(CPTPlot *)plot inRect:(CGRect)rect inContext:(CGContextRef)context; +-(void)legend:(CPTLegend *)legend legendEntryForPlot:(CPTPlot *)plot wasSelectedAtIndex:(NSUInteger)idx; + +/** @brief @optional Informs the delegate that the swatch or label of a legend entry was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param legend The legend. + * @param plot The plot associated with the selected legend entry. + * @param idx The index of the + * @if MacOnly clicked legend entry. @endif + * @if iOSOnly touched legend entry. @endif + * @param event The event that triggered the selection. + **/ +-(void)legend:(CPTLegend *)legend legendEntryForPlot:(CPTPlot *)plot wasSelectedAtIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; -/// @} +/// @} @end #pragma mark - @interface CPTLegend : CPTBorderedLayer { - @private - NSMutableArray *plots; - NSMutableArray *legendEntries; - BOOL layoutChanged; - CPTTextStyle *textStyle; - CGSize swatchSize; - CPTLineStyle *swatchBorderLineStyle; - CGFloat swatchCornerRadius; - CPTFill *swatchFill; - NSUInteger numberOfRows; - NSUInteger numberOfColumns; - BOOL equalRows; - BOOL equalColumns; - NSArray *rowHeights; - NSArray *rowHeightsThatFit; - NSArray *columnWidths; - NSArray *columnWidthsThatFit; - CGFloat columnMargin; - CGFloat rowMargin; - CGFloat titleOffset; + @private + NSMutableArray *plots; + NSMutableArray *legendEntries; + BOOL layoutChanged; + CPTTextStyle *textStyle; + CGSize swatchSize; + CPTLineStyle *swatchBorderLineStyle; + CGFloat swatchCornerRadius; + CPTFill *swatchFill; + CPTLineStyle *entryBorderLineStyle; + CGFloat entryCornerRadius; + CPTFill *entryFill; + CGFloat entryPaddingLeft; + CGFloat entryPaddingTop; + CGFloat entryPaddingRight; + CGFloat entryPaddingBottom; + NSUInteger numberOfRows; + NSUInteger numberOfColumns; + BOOL equalRows; + BOOL equalColumns; + NSArray *rowHeights; + NSArray *rowHeightsThatFit; + NSArray *columnWidths; + NSArray *columnWidthsThatFit; + CGFloat columnMargin; + CGFloat rowMargin; + CGFloat titleOffset; } /// @name Formatting @@ -85,7 +155,15 @@ extern NSString *const CPTLegendNeedsReloadEntriesForPlotNotification; @property (nonatomic, readwrite, copy) CPTLineStyle *swatchBorderLineStyle; @property (nonatomic, readwrite, assign) CGFloat swatchCornerRadius; @property (nonatomic, readwrite, copy) CPTFill *swatchFill; -/// @} + +@property (nonatomic, readwrite, copy) CPTLineStyle *entryBorderLineStyle; +@property (nonatomic, readwrite, assign) CGFloat entryCornerRadius; +@property (nonatomic, readwrite, copy) CPTFill *entryFill; +@property (nonatomic, readwrite, assign) CGFloat entryPaddingLeft; +@property (nonatomic, readwrite, assign) CGFloat entryPaddingTop; +@property (nonatomic, readwrite, assign) CGFloat entryPaddingRight; +@property (nonatomic, readwrite, assign) CGFloat entryPaddingBottom; +/// @} /// @name Layout /// @{ @@ -101,35 +179,35 @@ extern NSString *const CPTLegendNeedsReloadEntriesForPlotNotification; @property (nonatomic, readwrite, assign) CGFloat columnMargin; @property (nonatomic, readwrite, assign) CGFloat rowMargin; @property (nonatomic, readwrite, assign) CGFloat titleOffset; -/// @} +/// @} /// @name Factory Methods /// @{ +(id)legendWithPlots:(NSArray *)newPlots; +(id)legendWithGraph:(CPTGraph *)graph; -/// @} +/// @} /// @name Initialization /// @{ -(id)initWithPlots:(NSArray *)newPlots; -(id)initWithGraph:(CPTGraph *)graph; -/// @} +/// @} /// @name Plots /// @{ -(NSArray *)allPlots; --(CPTPlot *)plotAtIndex:(NSUInteger)index; +-(CPTPlot *)plotAtIndex:(NSUInteger)idx; -(CPTPlot *)plotWithIdentifier:(id)identifier; -(void)addPlot:(CPTPlot *)plot; --(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)index; +-(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx; -(void)removePlot:(CPTPlot *)plot; -(void)removePlotWithIdentifier:(id)identifier; -/// @} +/// @} /// @name Layout /// @{ -(void)setLayoutChanged; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTLegendEntry.h b/ios/CorePlot/CorePlotHeaders/CPTLegendEntry.h index e35a248..e887d67 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTLegendEntry.h +++ b/ios/CorePlot/CorePlotHeaders/CPTLegendEntry.h @@ -1,40 +1,38 @@ #import "CPTDefinitions.h" -#import -#import @class CPTPlot; @class CPTTextStyle; @interface CPTLegendEntry : NSObject { - @private - __cpt_weak CPTPlot *plot; - NSUInteger index; - NSUInteger row; - NSUInteger column; - CPTTextStyle *textStyle; + @private + __cpt_weak CPTPlot *plot; + NSUInteger index; + NSUInteger row; + NSUInteger column; + CPTTextStyle *textStyle; } /// @name Plot Info /// @{ @property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTPlot *plot; @property (nonatomic, readwrite, assign) NSUInteger index; -/// @} +/// @} /// @name Formatting /// @{ @property (nonatomic, readwrite, retain) CPTTextStyle *textStyle; -/// @} +/// @} /// @name Layout /// @{ @property (nonatomic, readwrite, assign) NSUInteger row; @property (nonatomic, readwrite, assign) NSUInteger column; @property (nonatomic, readonly, assign) CGSize titleSize; -/// @} +/// @} /// @name Drawing /// @{ -(void)drawTitleInRect:(CGRect)rect inContext:(CGContextRef)context scale:(CGFloat)scale; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTLimitBand.h b/ios/CorePlot/CorePlotHeaders/CPTLimitBand.h index f932e9a..6c191f6 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTLimitBand.h +++ b/ios/CorePlot/CorePlotHeaders/CPTLimitBand.h @@ -1,12 +1,10 @@ -#import - @class CPTPlotRange; @class CPTFill; @interface CPTLimitBand : NSObject { - @private - CPTPlotRange *range; - CPTFill *fill; + @private + CPTPlotRange *range; + CPTFill *fill; } @property (nonatomic, readwrite, retain) CPTPlotRange *range; @@ -15,11 +13,11 @@ /// @name Factory Methods /// @{ +(CPTLimitBand *)limitBandWithRange:(CPTPlotRange *)newRange fill:(CPTFill *)newFill; -/// @} +/// @} /// @name Initialization /// @{ -(id)initWithRange:(CPTPlotRange *)newRange fill:(CPTFill *)newFill; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTLineCap.h b/ios/CorePlot/CorePlotHeaders/CPTLineCap.h index 037f133..3b29d28 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTLineCap.h +++ b/ios/CorePlot/CorePlotHeaders/CPTLineCap.h @@ -1,40 +1,37 @@ -#import -#import - /// @file @class CPTLineStyle; @class CPTFill; /** - * @brief Line cap types. + * @brief Line cap types. **/ typedef enum _CPTLineCapType { - CPTLineCapTypeNone, ///< No line cap. - CPTLineCapTypeOpenArrow, ///< Open arrow line cap. - CPTLineCapTypeSolidArrow, ///< Solid arrow line cap. - CPTLineCapTypeSweptArrow, ///< Swept arrow line cap. - CPTLineCapTypeRectangle, ///< Rectangle line cap. - CPTLineCapTypeEllipse, ///< Elliptical line cap. - CPTLineCapTypeDiamond, ///< Diamond line cap. - CPTLineCapTypePentagon, ///< Pentagon line cap. - CPTLineCapTypeHexagon, ///< Hexagon line cap. - CPTLineCapTypeBar, ///< Bar line cap. - CPTLineCapTypeCross, ///< X line cap. - CPTLineCapTypeSnow, ///< Snowflake line cap. - CPTLineCapTypeCustom ///< Custom line cap. + CPTLineCapTypeNone, ///< No line cap. + CPTLineCapTypeOpenArrow, ///< Open arrow line cap. + CPTLineCapTypeSolidArrow, ///< Solid arrow line cap. + CPTLineCapTypeSweptArrow, ///< Swept arrow line cap. + CPTLineCapTypeRectangle, ///< Rectangle line cap. + CPTLineCapTypeEllipse, ///< Elliptical line cap. + CPTLineCapTypeDiamond, ///< Diamond line cap. + CPTLineCapTypePentagon, ///< Pentagon line cap. + CPTLineCapTypeHexagon, ///< Hexagon line cap. + CPTLineCapTypeBar, ///< Bar line cap. + CPTLineCapTypeCross, ///< X line cap. + CPTLineCapTypeSnow, ///< Snowflake line cap. + CPTLineCapTypeCustom ///< Custom line cap. } CPTLineCapType; @interface CPTLineCap : NSObject { - @private - CGSize size; - CPTLineCapType lineCapType; - CPTLineStyle *lineStyle; - CPTFill *fill; - CGPathRef cachedLineCapPath; - CGPathRef customLineCapPath; - BOOL usesEvenOddClipRule; + @private + CGSize size; + CPTLineCapType lineCapType; + CPTLineStyle *lineStyle; + CPTFill *fill; + CGPathRef cachedLineCapPath; + CGPathRef customLineCapPath; + BOOL usesEvenOddClipRule; } @property (nonatomic, readwrite, assign) CGSize size; @@ -59,11 +56,11 @@ CPTLineCapType; +(CPTLineCap *)crossPlotLineCap; +(CPTLineCap *)snowPlotLineCap; +(CPTLineCap *)customLineCapWithPath:(CGPathRef)aPath; -/// @} +/// @} /// @name Drawing /// @{ --(void)renderAsVectorInContext:(CGContextRef)theContext atPoint:(CGPoint)center inDirection:(CGPoint)direction; -/// @} +-(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center inDirection:(CGPoint)direction; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTLineStyle.h b/ios/CorePlot/CorePlotHeaders/CPTLineStyle.h index 66202fa..69ed1fa 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTLineStyle.h +++ b/ios/CorePlot/CorePlotHeaders/CPTLineStyle.h @@ -1,19 +1,20 @@ -#import -#import - @class CPTColor; +@class CPTFill; +@class CPTGradient; @interface CPTLineStyle : NSObject { - @private - CGLineCap lineCap; -// CGLineDash lineDash; // We should make a struct to keep this information - CGLineJoin lineJoin; - CGFloat miterLimit; - CGFloat lineWidth; - NSArray *dashPattern; - CGFloat patternPhase; -// StrokePattern; // We should make a struct to keep this information - CPTColor *lineColor; + @private + CGLineCap lineCap; +// CGLineDash lineDash; // We should make a struct to keep this information + CGLineJoin lineJoin; + CGFloat miterLimit; + CGFloat lineWidth; + NSArray *dashPattern; + CGFloat patternPhase; +// StrokePattern; // We should make a struct to keep this information + CPTColor *lineColor; + CPTFill *lineFill; + CPTGradient *lineGradient; } @property (nonatomic, readonly, assign) CGLineCap lineCap; @@ -23,15 +24,20 @@ @property (nonatomic, readonly, retain) NSArray *dashPattern; @property (nonatomic, readonly, assign) CGFloat patternPhase; @property (nonatomic, readonly, retain) CPTColor *lineColor; +@property (nonatomic, readonly, retain) CPTFill *lineFill; +@property (nonatomic, readonly, retain) CPTGradient *lineGradient; +@property (nonatomic, readonly, getter = isOpaque) BOOL opaque; /// @name Factory Methods /// @{ +(id)lineStyle; -/// @} +/// @} /// @name Drawing /// @{ --(void)setLineStyleInContext:(CGContextRef)theContext; -/// @} +-(void)setLineStyleInContext:(CGContextRef)context; +-(void)strokePathInContext:(CGContextRef)context; +-(void)strokeRect:(CGRect)rect inContext:(CGContextRef)context; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTMutableLineStyle.h b/ios/CorePlot/CorePlotHeaders/CPTMutableLineStyle.h index a740394..d242fe0 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTMutableLineStyle.h +++ b/ios/CorePlot/CorePlotHeaders/CPTMutableLineStyle.h @@ -1,5 +1,4 @@ #import "CPTLineStyle.h" -#import @class CPTColor; @@ -13,5 +12,7 @@ @property (nonatomic, readwrite, retain) NSArray *dashPattern; @property (nonatomic, readwrite, assign) CGFloat patternPhase; @property (nonatomic, readwrite, retain) CPTColor *lineColor; +@property (nonatomic, readwrite, retain) CPTFill *lineFill; +@property (nonatomic, readwrite, retain) CPTGradient *lineGradient; @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTMutableNumericData+TypeConversion.h b/ios/CorePlot/CorePlotHeaders/CPTMutableNumericData+TypeConversion.h index f762c3e..3df4ca0 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTMutableNumericData+TypeConversion.h +++ b/ios/CorePlot/CorePlotHeaders/CPTMutableNumericData+TypeConversion.h @@ -1,23 +1,22 @@ #import "CPTMutableNumericData.h" #import "CPTNumericDataType.h" -#import -/** @category CPTMutableNumericData(TypeConversion) - * @brief Type conversion methods for CPTMutableNumericData. +/** @category CPTMutableNumericData(TypeConversion) + * @brief Type conversion methods for CPTMutableNumericData. **/ @interface CPTMutableNumericData(TypeConversion) /// @name Data Format /// @{ -@property (assign, readwrite) CPTNumericDataType dataType; -@property (assign, readwrite) CPTDataTypeFormat dataTypeFormat; -@property (assign, readwrite) size_t sampleBytes; -@property (assign, readwrite) CFByteOrder byteOrder; -/// @} +@property (readwrite, assign) CPTNumericDataType dataType; +@property (readwrite, assign) CPTDataTypeFormat dataTypeFormat; +@property (readwrite, assign) size_t sampleBytes; +@property (readwrite, assign) CFByteOrder byteOrder; +/// @} /// @name Type Conversion /// @{ -(void)convertToType:(CPTDataTypeFormat)newDataType sampleBytes:(size_t)newSampleBytes byteOrder:(CFByteOrder)newByteOrder; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTMutableNumericData.h b/ios/CorePlot/CorePlotHeaders/CPTMutableNumericData.h index 3e25674..61a723d 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTMutableNumericData.h +++ b/ios/CorePlot/CorePlotHeaders/CPTMutableNumericData.h @@ -1,6 +1,5 @@ #import "CPTNumericData.h" #import "CPTNumericDataType.h" -#import @interface CPTMutableNumericData : CPTNumericData { } @@ -8,22 +7,11 @@ /// @name Data Buffer /// @{ @property (readonly) void *mutableBytes; -/// @} +/// @} /// @name Dimensions /// @{ @property (copy, readwrite) NSArray *shape; -/// @} - -/// @name Factory Methods -/// @{ -+(CPTMutableNumericData *)numericDataWithData:(NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray; -+(CPTMutableNumericData *)numericDataWithData:(NSData *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray; -/// @} - -/// @name Initialization -/// @{ --(id)initWithData:(NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTMutablePlotRange.h b/ios/CorePlot/CorePlotHeaders/CPTMutablePlotRange.h index 8687af4..fa3f6be 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTMutablePlotRange.h +++ b/ios/CorePlot/CorePlotHeaders/CPTMutablePlotRange.h @@ -7,23 +7,23 @@ /// @{ @property (nonatomic, readwrite) NSDecimal location; @property (nonatomic, readwrite) NSDecimal length; -/// @} +/// @} /// @name Combining Ranges /// @{ -(void)unionPlotRange:(CPTPlotRange *)otherRange; -(void)intersectionPlotRange:(CPTPlotRange *)otherRange; -/// @} +/// @} /// @name Shifting Ranges /// @{ -(void)shiftLocationToFitInRange:(CPTPlotRange *)otherRange; -(void)shiftEndToFitInRange:(CPTPlotRange *)otherRange; -/// @} +/// @} /// @name Expanding/Contracting Ranges /// @{ -(void)expandRangeByFactor:(NSDecimal)factor; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTMutableShadow.h b/ios/CorePlot/CorePlotHeaders/CPTMutableShadow.h index 064cb5d..2d79655 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTMutableShadow.h +++ b/ios/CorePlot/CorePlotHeaders/CPTMutableShadow.h @@ -1,6 +1,4 @@ #import "CPTShadow.h" -#import -#import @class CPTColor; diff --git a/ios/CorePlot/CorePlotHeaders/CPTMutableTextStyle.h b/ios/CorePlot/CorePlotHeaders/CPTMutableTextStyle.h index 07fbdfe..8f8e707 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTMutableTextStyle.h +++ b/ios/CorePlot/CorePlotHeaders/CPTMutableTextStyle.h @@ -1,5 +1,4 @@ #import "CPTTextStyle.h" -#import @class CPTColor; @@ -10,5 +9,6 @@ @property (readwrite, assign, nonatomic) CGFloat fontSize; @property (readwrite, copy, nonatomic) CPTColor *color; @property (readwrite, assign, nonatomic) CPTTextAlignment textAlignment; +@property (readwrite, assign, nonatomic) NSLineBreakMode lineBreakMode; @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTNumericData+TypeConversion.h b/ios/CorePlot/CorePlotHeaders/CPTNumericData+TypeConversion.h index 1752594..7ae0179 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTNumericData+TypeConversion.h +++ b/ios/CorePlot/CorePlotHeaders/CPTNumericData+TypeConversion.h @@ -1,9 +1,8 @@ #import "CPTNumericData.h" #import "CPTNumericDataType.h" -#import -/** @category CPTNumericData(TypeConversion) - * @brief Type conversion methods for CPTNumericData. +/** @category CPTNumericData(TypeConversion) + * @brief Type conversion methods for CPTNumericData. **/ @interface CPTNumericData(TypeConversion) @@ -12,12 +11,12 @@ -(CPTNumericData *)dataByConvertingToDataType:(CPTNumericDataType)newDataType; -(CPTNumericData *)dataByConvertingToType:(CPTDataTypeFormat)newDataType sampleBytes:(size_t)newSampleBytes byteOrder:(CFByteOrder)newByteOrder; -/// @} +/// @} /// @name Data Conversion Utilities /// @{ -(void)convertData:(NSData *)sourceData dataType:(CPTNumericDataType *)sourceDataType toData:(NSMutableData *)destData dataType:(CPTNumericDataType *)destDataType; -(void)swapByteOrderForData:(NSMutableData *)sourceData sampleSize:(size_t)sampleSize; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTNumericData.h b/ios/CorePlot/CorePlotHeaders/CPTNumericData.h index d36b77f..15fdd9b 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTNumericData.h +++ b/ios/CorePlot/CorePlotHeaders/CPTNumericData.h @@ -1,42 +1,48 @@ #import "CPTNumericDataType.h" -#import @interface CPTNumericData : NSObject { - @protected - NSData *data; - CPTNumericDataType dataType; - NSArray *shape; // array of dimension shapes (NSNumber) + @protected + NSData *data; + CPTNumericDataType dataType; + NSArray *shape; // array of dimension shapes (NSNumber) + CPTDataOrder dataOrder; } /// @name Data Buffer /// @{ -@property (copy, readonly) NSData *data; -@property (readonly) const void *bytes; -@property (readonly) NSUInteger length; -/// @} +@property (readonly, copy) NSData *data; +@property (readonly, assign) const void *bytes; +@property (readonly, assign) NSUInteger length; +/// @} /// @name Data Format /// @{ -@property (assign, readonly) CPTNumericDataType dataType; -@property (readonly) CPTDataTypeFormat dataTypeFormat; -@property (readonly) size_t sampleBytes; -@property (readonly) CFByteOrder byteOrder; -/// @} +@property (readonly, assign) CPTNumericDataType dataType; +@property (readonly, assign) CPTDataTypeFormat dataTypeFormat; +@property (readonly, assign) size_t sampleBytes; +@property (readonly, assign) CFByteOrder byteOrder; +/// @} /// @name Dimensions /// @{ -@property (copy, readonly) NSArray *shape; -@property (readonly) NSUInteger numberOfDimensions; -@property (readonly) NSUInteger numberOfSamples; -/// @} +@property (readonly, copy) NSArray *shape; +@property (readonly, assign) NSUInteger numberOfDimensions; +@property (readonly, assign) NSUInteger numberOfSamples; +@property (readonly, assign) CPTDataOrder dataOrder; +/// @} /// @name Factory Methods /// @{ -+(CPTNumericData *)numericDataWithData:(NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray; -+(CPTNumericData *)numericDataWithData:(NSData *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray; -+(CPTNumericData *)numericDataWithArray:(NSArray *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray; -+(CPTNumericData *)numericDataWithArray:(NSArray *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray; -/// @} ++(id)numericDataWithData:(NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray; ++(id)numericDataWithData:(NSData *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray; ++(id)numericDataWithArray:(NSArray *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray; ++(id)numericDataWithArray:(NSArray *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray; + ++(id)numericDataWithData:(NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; ++(id)numericDataWithData:(NSData *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; ++(id)numericDataWithArray:(NSArray *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; ++(id)numericDataWithArray:(NSArray *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; +/// @} /// @name Initialization /// @{ @@ -44,13 +50,21 @@ -(id)initWithData:(NSData *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray; -(id)initWithArray:(NSArray *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray; -(id)initWithArray:(NSArray *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray; -/// @} + +-(id)initWithData:(NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; +-(id)initWithData:(NSData *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; +-(id)initWithArray:(NSArray *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; +-(id)initWithArray:(NSArray *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; +/// @} /// @name Samples /// @{ +-(NSUInteger)sampleIndex:(NSUInteger)idx, ...; -(void *)samplePointer:(NSUInteger)sample; +-(void *)samplePointerAtIndex:(NSUInteger)idx, ...; -(NSNumber *)sampleValue:(NSUInteger)sample; +-(NSNumber *)sampleValueAtIndex:(NSUInteger)idx, ...; -(NSArray *)sampleArray; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTNumericDataType.h b/ios/CorePlot/CorePlotHeaders/CPTNumericDataType.h index 2ef8950..d553aaa 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTNumericDataType.h +++ b/ios/CorePlot/CorePlotHeaders/CPTNumericDataType.h @@ -1,27 +1,35 @@ -#import - /// @file /** - * @brief Enumeration of data formats for numeric data. + * @brief Enumeration of data formats for numeric data. **/ typedef enum _CPTDataTypeFormat { - CPTUndefinedDataType = 0, ///< Undefined - CPTIntegerDataType, ///< Integer - CPTUnsignedIntegerDataType, ///< Unsigned integer - CPTFloatingPointDataType, ///< Floating point - CPTComplexFloatingPointDataType, ///< Complex floating point - CPTDecimalDataType ///< NSDecimal + CPTUndefinedDataType = 0, ///< Undefined + CPTIntegerDataType, ///< Integer + CPTUnsignedIntegerDataType, ///< Unsigned integer + CPTFloatingPointDataType, ///< Floating point + CPTComplexFloatingPointDataType, ///< Complex floating point + CPTDecimalDataType ///< NSDecimal } CPTDataTypeFormat; /** - * @brief Struct that describes the encoding of numeric data samples. + * @brief Enumeration of memory arrangements for multi-dimensional data arrays. + * @see See Wikipedia for more information. + **/ +typedef enum _CPTDataOrder { + CPTDataOrderRowsFirst, ///< Numeric data is arranged in row-major order. + CPTDataOrderColumnsFirst ///< Numeric data is arranged in column-major order. +} +CPTDataOrder; + +/** + * @brief Structure that describes the encoding of numeric data samples. **/ typedef struct _CPTNumericDataType { - CPTDataTypeFormat dataTypeFormat; ///< Data type format - size_t sampleBytes; ///< Number of bytes in each sample - CFByteOrder byteOrder; ///< Byte order + CPTDataTypeFormat dataTypeFormat; ///< Data type format + size_t sampleBytes; ///< Number of bytes in each sample + CFByteOrder byteOrder; ///< Byte order } CPTNumericDataType; @@ -37,7 +45,7 @@ NSString *CPTDataTypeStringFromDataType(CPTNumericDataType dataType); BOOL CPTDataTypeIsSupported(CPTNumericDataType format); BOOL CPTDataTypeEqualToDataType(CPTNumericDataType dataType1, CPTNumericDataType dataType2); -/// @} +/// @} #if __cplusplus } diff --git a/ios/CorePlot/CorePlotHeaders/CPTPathExtensions.h b/ios/CorePlot/CorePlotHeaders/CPTPathExtensions.h index 3d3e328..8229a41 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPathExtensions.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPathExtensions.h @@ -1,6 +1,3 @@ -#import -#import - /// @file #if __cplusplus diff --git a/ios/CorePlot/CorePlotHeaders/CPTPieChart.h b/ios/CorePlot/CorePlotHeaders/CPTPieChart.h index 908b63c..334bb6e 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPieChart.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPieChart.h @@ -1,8 +1,7 @@ #import "CPTDefinitions.h" #import "CPTPlot.h" -#import -/// @file +/// @file @class CPTColor; @class CPTFill; @@ -12,121 +11,187 @@ @class CPTTextLayer; @class CPTLineStyle; -/// @ingroup plotBindingsPieChart +/// @ingroup plotBindingsPieChart /// @{ extern NSString *const CPTPieChartBindingPieSliceWidthValues; -/// @} +extern NSString *const CPTPieChartBindingPieSliceFills; +extern NSString *const CPTPieChartBindingPieSliceRadialOffsets; +/// @} /** - * @brief Enumeration of pie chart data source field types. + * @brief Enumeration of pie chart data source field types. **/ typedef enum _CPTPieChartField { - CPTPieChartFieldSliceWidth, ///< Pie slice width. - CPTPieChartFieldSliceWidthNormalized, ///< Pie slice width normalized [0, 1]. - CPTPieChartFieldSliceWidthSum ///< Cumulative sum of pie slice widths. + CPTPieChartFieldSliceWidth, ///< Pie slice width. + CPTPieChartFieldSliceWidthNormalized, ///< Pie slice width normalized [0, 1]. + CPTPieChartFieldSliceWidthSum ///< Cumulative sum of pie slice widths. } CPTPieChartField; /** - * @brief Enumeration of pie slice drawing directions. + * @brief Enumeration of pie slice drawing directions. **/ typedef enum _CPTPieDirection { - CPTPieDirectionClockwise, ///< Pie slices are drawn in a clockwise direction. - CPTPieDirectionCounterClockwise ///< Pie slices are drawn in a counter-clockwise direction. + CPTPieDirectionClockwise, ///< Pie slices are drawn in a clockwise direction. + CPTPieDirectionCounterClockwise ///< Pie slices are drawn in a counter-clockwise direction. } CPTPieDirection; #pragma mark - /** - * @brief A pie chart data source. + * @brief A pie chart data source. **/ @protocol CPTPieChartDataSource @optional -/// @name Slice Style -/// @{ +/// @name Slice Style +/// @{ -/** @brief (Optional) Gets a fill for the given pie chart slice. - * @param pieChart The pie chart. - * @param index The data index of interest. - * @return The pie slice fill for the slice with the given index. +/** @brief @optional Gets a range of slice fills for the given pie chart. + * @param pieChart The pie chart. + * @param indexRange The range of the data indexes of interest. + * @return An array of pie slice fills. + **/ +-(NSArray *)sliceFillsForPieChart:(CPTPieChart *)pieChart recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets a fill for the given pie chart slice. + * This method will not be called if + * @link CPTPieChartDataSource::sliceFillsForPieChart:recordIndexRange: -sliceFillsForPieChart:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param pieChart The pie chart. + * @param idx The data index of interest. + * @return The pie slice fill for the slice with the given index. If the datasource returns @nil, the default fill is used. + * If the data source returns an NSNull object, no fill is drawn. **/ --(CPTFill *)sliceFillForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)index; +-(CPTFill *)sliceFillForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)idx; -/// @} +/// @} -/// @name Slice Layout -/// @{ +/// @name Slice Layout +/// @{ -/** @brief (Optional) Offsets the slice radially from the center point. Can be used to "explode" the chart. - * @param pieChart The pie chart. - * @param index The data index of interest. - * @return The radial offset in view coordinates. Zero is no offset. +/** @brief @optional Gets a range of slice offsets for the given pie chart. + * @param pieChart The pie chart. + * @param indexRange The range of the data indexes of interest. + * @return An array of radial offsets. + **/ +-(NSArray *)radialOffsetsForPieChart:(CPTPieChart *)pieChart recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Offsets the slice radially from the center point. Can be used to @quote{explode} the chart. + * This method will not be called if + * @link CPTPieChartDataSource::radialOffsetsForPieChart:recordIndexRange: -radialOffsetsForPieChart:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param pieChart The pie chart. + * @param idx The data index of interest. + * @return The radial offset in view coordinates. Zero is no offset. **/ --(CGFloat)radialOffsetForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)index; +-(CGFloat)radialOffsetForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)idx; -/// @{ +/// @} /// @name Legends /// @{ -/** @brief (Optional) Gets the legend title for the given pie chart slice. - * @param pieChart The pie chart. - * @param index The data index of interest. - * @return The title text for the legend entry for the point with the given index. +/** @brief @optional Gets the legend title for the given pie chart slice. + * @param pieChart The pie chart. + * @param idx The data index of interest. + * @return The title text for the legend entry for the point with the given index. + **/ +-(NSString *)legendTitleForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)idx; + +/** @brief @optional Gets the styled legend title for the given pie chart slice. + * @param pieChart The pie chart. + * @param idx The data index of interest. + * @return The styled title text for the legend entry for the point with the given index. **/ --(NSString *)legendTitleForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)index; +-(NSAttributedString *)attributedLegendTitleForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)idx; -/// @} +/// @} @end #pragma mark - /** - * @brief Pie chart delegate. + * @brief Pie chart delegate. **/ -@protocol CPTPieChartDelegate +@protocol CPTPieChartDelegate @optional -/// @name Point Selection +/// @name Slice Selection /// @{ -/** @brief (Optional) Informs the delegate that a pie slice was touched or clicked. - * @param plot The pie chart. - * @param index The index of the slice that was touched or clicked. +/** @brief @optional Informs the delegate that a pie slice was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The pie chart. + * @param idx The index of the + * @if MacOnly clicked pie slice. @endif + * @if iOSOnly touched pie slice. @endif + **/ +-(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)idx; + +/** @brief @optional Informs the delegate that a pie slice was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The pie chart. + * @param idx The index of the + * @if MacOnly clicked pie slice. @endif + * @if iOSOnly touched pie slice. @endif + * @param event The event that triggered the selection. **/ --(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index; +-(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; -/// @} +/// @} @end #pragma mark - @interface CPTPieChart : CPTPlot { - @private - CGFloat pieRadius; - CGFloat pieInnerRadius; - CGFloat startAngle; - CPTPieDirection sliceDirection; - CGPoint centerAnchor; - CPTLineStyle *borderLineStyle; - CPTFill *overlayFill; + @private + CGFloat pieRadius; + CGFloat pieInnerRadius; + CGFloat startAngle; + CGFloat endAngle; + CPTPieDirection sliceDirection; + CGPoint centerAnchor; + CPTLineStyle *borderLineStyle; + CPTFill *overlayFill; + BOOL labelRotationRelativeToRadius; } +/// @name Appearance +/// @{ @property (nonatomic, readwrite) CGFloat pieRadius; @property (nonatomic, readwrite) CGFloat pieInnerRadius; @property (nonatomic, readwrite) CGFloat startAngle; +@property (nonatomic, readwrite) CGFloat endAngle; @property (nonatomic, readwrite) CPTPieDirection sliceDirection; @property (nonatomic, readwrite) CGPoint centerAnchor; +/// @} + +/// @name Drawing +/// @{ @property (nonatomic, readwrite, copy) CPTLineStyle *borderLineStyle; @property (nonatomic, readwrite, copy) CPTFill *overlayFill; +/// @} + +/// @name Data Labels +/// @{ +@property (nonatomic, readwrite, assign) BOOL labelRotationRelativeToRadius; +/// @} + +/// @name Information +/// @{ +-(NSUInteger)pieSliceIndexAtAngle:(CGFloat)angle; +-(CGFloat)medianAngleForPieSliceIndex:(NSUInteger)idx; +/// @} /// @name Factory Methods /// @{ +(CPTColor *)defaultPieSliceColorForIndex:(NSUInteger)pieSliceIndex; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificCategories.h b/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificCategories.h index 4e0fdc0..d613887 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificCategories.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificCategories.h @@ -1,10 +1,11 @@ #import "CPTColor.h" #import "CPTLayer.h" #import "CPTPlatformSpecificDefines.h" -#import -/** @category CPTColor(CPTPlatformSpecificColorExtensions) - * @brief Platform-specific extensions to CPTColor. +#pragma mark CPTColor + +/** @category CPTColor(CPTPlatformSpecificColorExtensions) + * @brief Platform-specific extensions to CPTColor. **/ @interface CPTColor(CPTPlatformSpecificColorExtensions) @@ -12,20 +13,24 @@ @end -/** @category CPTLayer(CPTPlatformSpecificLayerExtensions) - * @brief Platform-specific extensions to CPTLayer. +#pragma mark - CPTLayer + +/** @category CPTLayer(CPTPlatformSpecificLayerExtensions) + * @brief Platform-specific extensions to CPTLayer. **/ @interface CPTLayer(CPTPlatformSpecificLayerExtensions) /// @name Images /// @{ -(CPTNativeImage *)imageOfLayer; -/// @} +/// @} @end -/** @category NSNumber(CPTPlatformSpecificNumberExtensions) - * @brief Platform-specific extensions to NSNumber. +#pragma mark - NSNumber + +/** @category NSNumber(CPTPlatformSpecificNumberExtensions) + * @brief Platform-specific extensions to NSNumber. **/ @interface NSNumber(CPTPlatformSpecificNumberExtensions) @@ -35,3 +40,17 @@ -(BOOL)isGreaterThanOrEqualTo:(NSNumber *)other; @end + +#pragma mark - NSAttributedString + +/** @category NSAttributedString(CPTPlatformSpecificAttributedStringExtensions) + * @brief NSAttributedString extensions for drawing styled text. + **/ +@interface NSAttributedString(CPTPlatformSpecificAttributedStringExtensions) + +/// @name Drawing +/// @{ +-(void)drawInRect:(CGRect)rect inContext:(CGContextRef)context; +/// @} + +@end diff --git a/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificDefines.h b/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificDefines.h index 35d96aa..42dc526 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificDefines.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificDefines.h @@ -1,4 +1,2 @@ -#import -#import - -typedef UIImage CPTNativeImage; +typedef UIImage CPTNativeImage; ///< Platform-native image format. +typedef UIEvent CPTNativeEvent; ///< Platform-native OS event. diff --git a/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificFunctions.h b/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificFunctions.h index 5d38952..caa2c31 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificFunctions.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPlatformSpecificFunctions.h @@ -1,7 +1,4 @@ -#import -#import - -/// @file +/// @file #if __cplusplus extern "C" { @@ -12,7 +9,7 @@ extern "C" { void CPTPushCGContext(CGContextRef context); void CPTPopCGContext(void); -/// @} +/// @} /// @name Graphics Context /// @{ diff --git a/ios/CorePlot/CorePlotHeaders/CPTPlot.h b/ios/CorePlot/CorePlotHeaders/CPTPlot.h index 29d7908..c647a94 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPlot.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPlot.h @@ -1,8 +1,8 @@ #import "CPTAnnotationHostLayer.h" #import "CPTDefinitions.h" -#import "CPTMutableTextStyle.h" #import "CPTNumericDataType.h" -#import "CPTPlotRange.h" + +/// @file @class CPTLegend; @class CPTMutableNumericData; @@ -12,147 +12,230 @@ @class CPTPlotSpace; @class CPTPlotSpaceAnnotation; @class CPTPlotRange; +@class CPTTextStyle; -/// @file +/// @ingroup plotBindingsAllPlots +/// @{ +extern NSString *const CPTPlotBindingDataLabels; +/// @} /** - * @brief Enumeration of cache precisions. + * @brief Enumeration of cache precisions. **/ typedef enum _CPTPlotCachePrecision { - CPTPlotCachePrecisionAuto, ///< Cache precision is determined automatically from the data. All cached data will be converted to match the last data loaded. - CPTPlotCachePrecisionDouble, ///< All cached data will be converted to double precision. - CPTPlotCachePrecisionDecimal ///< All cached data will be converted to NSDecimal. + CPTPlotCachePrecisionAuto, ///< Cache precision is determined automatically from the data. All cached data will be converted to match the last data loaded. + CPTPlotCachePrecisionDouble, ///< All cached data will be converted to double precision. + CPTPlotCachePrecisionDecimal ///< All cached data will be converted to @ref NSDecimal. } CPTPlotCachePrecision; #pragma mark - /** - * @brief A plot data source. + * @brief A plot data source. **/ @protocol CPTPlotDataSource /// @name Data Values /// @{ -/** @brief (Required) The number of data points for the plot. - * @param plot The plot. - * @return The number of data points for the plot. +/** @brief @required The number of data points for the plot. + * @param plot The plot. + * @return The number of data points for the plot. **/ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot; @optional -/** @brief (Optional) Gets a range of plot data for the given plot and field. - * Implement one and only one of the optional methods in this section. - * @param plot The plot. - * @param fieldEnum The field index. - * @param indexRange The range of the data indexes of interest. - * @return An array of data points. +/** @brief @optional Gets a range of plot data for the given plot and field. + * Implement one and only one of the optional methods in this section. + * @param plot The plot. + * @param fieldEnum The field index. + * @param indexRange The range of the data indexes of interest. + * @return An array of data points. **/ -(NSArray *)numbersForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange; -/** @brief (Optional) Gets a plot data value for the given plot and field. - * Implement one and only one of the optional methods in this section. - * @param plot The plot. - * @param fieldEnum The field index. - * @param index The data index of interest. - * @return A data point. +/** @brief @optional Gets a plot data value for the given plot and field. + * Implement one and only one of the optional methods in this section. + * @param plot The plot. + * @param fieldEnum The field index. + * @param idx The data index of interest. + * @return A data point. **/ --(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index; - -/** @brief (Optional) Gets a range of plot data for the given plot and field. - * Implement one and only one of the optional methods in this section. - * @param plot The plot. - * @param fieldEnum The field index. - * @param indexRange The range of the data indexes of interest. - * @return A retained C array of data points. +-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx; + +/** @brief @optional Gets a range of plot data for the given plot and field. + * Implement one and only one of the optional methods in this section. + * @param plot The plot. + * @param fieldEnum The field index. + * @param indexRange The range of the data indexes of interest. + * @return A retained C array of data points. **/ -(double *)doublesForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange; -/** @brief (Optional) Gets a plot data value for the given plot and field. - * Implement one and only one of the optional methods in this section. - * @param plot The plot. - * @param fieldEnum The field index. - * @param index The data index of interest. - * @return A data point. +/** @brief @optional Gets a plot data value for the given plot and field. + * Implement one and only one of the optional methods in this section. + * @param plot The plot. + * @param fieldEnum The field index. + * @param idx The data index of interest. + * @return A data point. **/ --(double)doubleForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index; - -/** @brief (Optional) Gets a range of plot data for the given plot and field. - * Implement one and only one of the optional methods in this section. - * @param plot The plot. - * @param fieldEnum The field index. - * @param indexRange The range of the data indexes of interest. - * @return A one-dimensional array of data points. +-(double)doubleForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx; + +/** @brief @optional Gets a range of plot data for the given plot and field. + * Implement one and only one of the optional methods in this section. + * @param plot The plot. + * @param fieldEnum The field index. + * @param indexRange The range of the data indexes of interest. + * @return A one-dimensional array of data points. **/ -(CPTNumericData *)dataForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange; -/// @} +/** @brief @optional Gets a range of plot data for all fields of the given plot simultaneously. + * Implement one and only one of the optional methods in this section. + * + * The data returned from this method should be a two-dimensional array. It can be arranged + * in row- or column-major order although column-major will load faster, especially for large arrays. + * The array should have the same number of rows as the length of @par{indexRange}. + * The number of columns should be equal to the number of plot fields required by the plot. + * The column index (zero-based) corresponds with the field index. + * The data type will be converted to match the @link CPTPlot::cachePrecision cachePrecision @endlink if needed. + * + * @param plot The plot. + * @param indexRange The range of the data indexes of interest. + * @return A two-dimensional array of data points. + **/ +-(CPTNumericData *)dataForPlot:(CPTPlot *)plot recordIndexRange:(NSRange)indexRange; + +/// @} /// @name Data Labels /// @{ -/** @brief (Optional) Gets a data label for the given plot. - * @param plot The plot. - * @param index The data index of interest. - * @return The data label for the point with the given index. - * If you return nil, the default data label will be used. If you return an instance of NSNull, +/** @brief @optional Gets a range of data labels for the given plot. + * @param plot The plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of data labels. + **/ +-(NSArray *)dataLabelsForPlot:(CPTPlot *)plot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets a data label for the given plot. + * This method will not be called if + * @link CPTPlotDataSource::dataLabelsForPlot:recordIndexRange: -dataLabelsForPlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The plot. + * @param idx The data index of interest. + * @return The data label for the point with the given index. + * If you return @nil, the default data label will be used. If you return an instance of NSNull, * no label will be shown for the index in question. **/ --(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index; +-(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)idx; -/// @} +/// @} + +@end + +#pragma mark - + +/** + * @brief Plot delegate. + **/ +@protocol CPTPlotDelegate + +@optional + +/// @name Point Selection +/// @{ + +/** @brief @optional Informs the delegate that a data label was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The plot. + * @param idx The index of the + * @if MacOnly clicked data label. @endif + * @if iOSOnly touched data label. @endif + **/ +-(void)plot:(CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUInteger)idx; + +/** @brief @optional Informs the delegate that a data label was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The plot. + * @param idx The index of the + * @if MacOnly clicked data label. @endif + * @if iOSOnly touched data label. @endif + * @param event The event that triggered the selection. + **/ +-(void)plot:(CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; + +/// @} + +/// @name Drawing +/// @{ + +/** + * @brief @optional Informs the delegate that plot drawing is finished. + * @param plot The plot. + **/ +-(void)didFinishDrawing:(CPTPlot *)plot; + +/// @} @end #pragma mark - @interface CPTPlot : CPTAnnotationHostLayer { - @private - __cpt_weak id dataSource; - NSString *title; - CPTPlotSpace *plotSpace; - BOOL dataNeedsReloading; - NSMutableDictionary *cachedData; - NSUInteger cachedDataCount; - CPTPlotCachePrecision cachePrecision; - BOOL needsRelabel; - CGFloat labelOffset; - CGFloat labelRotation; - NSUInteger labelField; - CPTTextStyle *labelTextStyle; - NSNumberFormatter *labelFormatter; - NSRange labelIndexRange; - NSMutableArray *labelAnnotations; - CPTShadow *labelShadow; - BOOL alignsPointsToPixels; + @private + __cpt_weak id dataSource; + NSString *title; + NSAttributedString *attributedTitle; + CPTPlotSpace *plotSpace; + BOOL dataNeedsReloading; + NSMutableDictionary *cachedData; + NSUInteger cachedDataCount; + CPTPlotCachePrecision cachePrecision; + BOOL needsRelabel; + BOOL adjustLabelAnchors; + BOOL showLabels; + CGFloat labelOffset; + CGFloat labelRotation; + NSUInteger labelField; + CPTTextStyle *labelTextStyle; + NSFormatter *labelFormatter; + NSRange labelIndexRange; + NSMutableArray *labelAnnotations; + CPTShadow *labelShadow; + BOOL alignsPointsToPixels; + BOOL drawLegendSwatchDecoration; } /// @name Data Source /// @{ @property (nonatomic, readwrite, cpt_weak_property) __cpt_weak id dataSource; -/// @} +/// @} /// @name Identification /// @{ @property (nonatomic, readwrite, copy) NSString *title; -/// @} +@property (nonatomic, readwrite, copy) NSAttributedString *attributedTitle; +/// @} /// @name Plot Space /// @{ @property (nonatomic, readwrite, retain) CPTPlotSpace *plotSpace; -/// @} +/// @} /// @name Plot Area /// @{ @property (nonatomic, readonly, retain) CPTPlotArea *plotArea; -/// @} +/// @} /// @name Data Loading /// @{ @property (nonatomic, readonly, assign) BOOL dataNeedsReloading; -/// @} +/// @} /// @name Data Cache /// @{ @@ -161,23 +244,30 @@ CPTPlotCachePrecision; @property (nonatomic, readwrite, assign) CPTPlotCachePrecision cachePrecision; @property (nonatomic, readonly, assign) CPTNumericDataType doubleDataType; @property (nonatomic, readonly, assign) CPTNumericDataType decimalDataType; -/// @} +/// @} /// @name Data Labels /// @{ @property (nonatomic, readonly, assign) BOOL needsRelabel; +@property (nonatomic, readwrite, assign) BOOL adjustLabelAnchors; +@property (nonatomic, readwrite, assign) BOOL showLabels; @property (nonatomic, readwrite, assign) CGFloat labelOffset; @property (nonatomic, readwrite, assign) CGFloat labelRotation; @property (nonatomic, readwrite, assign) NSUInteger labelField; @property (nonatomic, readwrite, copy) CPTTextStyle *labelTextStyle; -@property (nonatomic, readwrite, retain) NSNumberFormatter *labelFormatter; +@property (nonatomic, readwrite, retain) NSFormatter *labelFormatter; @property (nonatomic, readwrite, retain) CPTShadow *labelShadow; -/// @} +/// @} /// @name Drawing /// @{ @property (nonatomic, readwrite, assign) BOOL alignsPointsToPixels; -/// @} +/// @} + +/// @name Legends +/// @{ +@property (nonatomic, readwrite, assign) BOOL drawLegendSwatchDecoration; +/// @} /// @name Data Labels /// @{ @@ -185,7 +275,7 @@ CPTPlotCachePrecision; -(void)relabel; -(void)relabelIndexRange:(NSRange)indexRange; -(void)repositionAllLabelAnnotations; -/// @} +/// @} /// @name Data Loading /// @{ @@ -193,44 +283,52 @@ CPTPlotCachePrecision; -(void)reloadData; -(void)reloadDataIfNeeded; -(void)reloadDataInIndexRange:(NSRange)indexRange; --(void)insertDataAtIndex:(NSUInteger)index numberOfRecords:(NSUInteger)numberOfRecords; +-(void)insertDataAtIndex:(NSUInteger)idx numberOfRecords:(NSUInteger)numberOfRecords; -(void)deleteDataInIndexRange:(NSRange)indexRange; -/// @} +/// @} /// @name Plot Data /// @{ ++(id)nilData; -(id)numbersFromDataSourceForField:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange; -/// @} +-(BOOL)loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:(NSRange)indexRange; +/// @} /// @name Data Cache /// @{ -(CPTMutableNumericData *)cachedNumbersForField:(NSUInteger)fieldEnum; --(NSNumber *)cachedNumberForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index; --(double)cachedDoubleForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index; --(NSDecimal)cachedDecimalForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index; +-(NSNumber *)cachedNumberForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx; +-(double)cachedDoubleForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx; +-(NSDecimal)cachedDecimalForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx; +-(NSArray *)cachedArrayForKey:(NSString *)key; +-(id)cachedValueForKey:(NSString *)key recordIndex:(NSUInteger)idx; + -(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum; --(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum atRecordIndex:(NSUInteger)index; -/// @} +-(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum atRecordIndex:(NSUInteger)idx; +-(void)cacheArray:(NSArray *)array forKey:(NSString *)key; +-(void)cacheArray:(NSArray *)array forKey:(NSString *)key atRecordIndex:(NSUInteger)idx; +/// @} /// @name Plot Data Ranges /// @{ -(CPTPlotRange *)plotRangeForField:(NSUInteger)fieldEnum; -(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coord; -/// @} +/// @} /// @name Legends /// @{ -(NSUInteger)numberOfLegendEntries; --(NSString *)titleForLegendEntryAtIndex:(NSUInteger)index; --(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)index inRect:(CGRect)rect inContext:(CGContextRef)context; -/// @} +-(NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx; +-(NSAttributedString *)attributedTitleForLegendEntryAtIndex:(NSUInteger)idx; +-(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(CGContextRef)context; +/// @} @end #pragma mark - -/** @category CPTPlot(AbstractMethods) - * @brief CPTPlot abstract methods—must be overridden by subclasses +/** @category CPTPlot(AbstractMethods) + * @brief CPTPlot abstract methods—must be overridden by subclasses **/ @interface CPTPlot(AbstractMethods) @@ -239,11 +337,16 @@ CPTPlotCachePrecision; -(NSUInteger)numberOfFields; -(NSArray *)fieldIdentifiers; -(NSArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord; -/// @} +/// @} /// @name Data Labels /// @{ --(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)index; -/// @} +-(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx; +/// @} + +/// @name User Interaction +/// @{ +-(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTPlotArea.h b/ios/CorePlot/CorePlotHeaders/CPTPlotArea.h index d920f99..bd8c7f9 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPlotArea.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPlotArea.h @@ -1,28 +1,59 @@ #import "CPTAnnotationHostLayer.h" #import "CPTGraph.h" #import "CPTLayer.h" -#import @class CPTAxis; @class CPTAxisLabelGroup; @class CPTAxisSet; @class CPTGridLineGroup; +@class CPTPlotArea; @class CPTPlotGroup; @class CPTLineStyle; @class CPTFill; +/** + * @brief Plot area delegate. + **/ +@protocol CPTPlotAreaDelegate + +@optional + +/// @name Plot Area Selection +/// @{ + +/** @brief @optional Informs the delegate that a plot area was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plotArea The plot area. + **/ +-(void)plotAreaWasSelected:(CPTPlotArea *)plotArea; + +/** @brief @optional Informs the delegate that a plot area was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plotArea The plot area. + * @param event The event that triggered the selection. + **/ +-(void)plotAreaWasSelected:(CPTPlotArea *)plotArea withEvent:(CPTNativeEvent *)event; + +/// @} + +@end + +#pragma mark - + @interface CPTPlotArea : CPTAnnotationHostLayer { - @private - CPTGridLineGroup *minorGridLineGroup; - CPTGridLineGroup *majorGridLineGroup; - CPTAxisSet *axisSet; - CPTPlotGroup *plotGroup; - CPTAxisLabelGroup *axisLabelGroup; - CPTAxisLabelGroup *axisTitleGroup; - CPTFill *fill; - NSArray *topDownLayerOrder; - CPTGraphLayerType *bottomUpLayerOrder; - BOOL updatingLayers; + @private + CPTGridLineGroup *minorGridLineGroup; + CPTGridLineGroup *majorGridLineGroup; + CPTAxisSet *axisSet; + CPTPlotGroup *plotGroup; + CPTAxisLabelGroup *axisLabelGroup; + CPTAxisLabelGroup *axisTitleGroup; + CPTFill *fill; + NSArray *topDownLayerOrder; + CPTGraphLayerType *bottomUpLayerOrder; + BOOL updatingLayers; } /// @name Layers @@ -33,24 +64,24 @@ @property (nonatomic, readwrite, retain) CPTPlotGroup *plotGroup; @property (nonatomic, readwrite, retain) CPTAxisLabelGroup *axisLabelGroup; @property (nonatomic, readwrite, retain) CPTAxisLabelGroup *axisTitleGroup; -/// @} +/// @} /// @name Layer Ordering /// @{ @property (nonatomic, readwrite, retain) NSArray *topDownLayerOrder; -/// @} +/// @} /// @name Decorations /// @{ @property (nonatomic, readwrite, copy) CPTLineStyle *borderLineStyle; @property (nonatomic, readwrite, copy) CPTFill *fill; -/// @} +/// @} /// @name Axis Set Layer Management /// @{ -(void)updateAxisSetLayersForType:(CPTGraphLayerType)layerType; -(void)setAxisSetLayersForType:(CPTGraphLayerType)layerType; -(unsigned)sublayerIndexForAxis:(CPTAxis *)axis layerType:(CPTGraphLayerType)layerType; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTPlotAreaFrame.h b/ios/CorePlot/CorePlotHeaders/CPTPlotAreaFrame.h index 7a2cbed..80b4442 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPlotAreaFrame.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPlotAreaFrame.h @@ -5,8 +5,8 @@ @class CPTPlotArea; @interface CPTPlotAreaFrame : CPTBorderedLayer { - @private - CPTPlotArea *plotArea; + @private + CPTPlotArea *plotArea; } @property (nonatomic, readonly, retain) CPTPlotArea *plotArea; diff --git a/ios/CorePlot/CorePlotHeaders/CPTPlotGroup.h b/ios/CorePlot/CorePlotHeaders/CPTPlotGroup.h index 5d75489..95f2dd8 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPlotGroup.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPlotGroup.h @@ -9,6 +9,7 @@ /// @{ -(void)addPlot:(CPTPlot *)plot; -(void)removePlot:(CPTPlot *)plot; -/// @} +-(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTPlotRange.h b/ios/CorePlot/CorePlotHeaders/CPTPlotRange.h index d787a3d..b633313 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPlotRange.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPlotRange.h @@ -1,24 +1,23 @@ #import "CPTDefinitions.h" -#import /// @file /** - * @brief Enumeration of possible results of a plot range comparison. + * @brief Enumeration of possible results of a plot range comparison. **/ typedef enum _CPTPlotRangeComparisonResult { - CPTPlotRangeComparisonResultNumberBelowRange, ///< Number is below the range. - CPTPlotRangeComparisonResultNumberInRange, ///< Number is in the range. - CPTPlotRangeComparisonResultNumberAboveRange ///< Number is above the range. + CPTPlotRangeComparisonResultNumberBelowRange, ///< Number is below the range. + CPTPlotRangeComparisonResultNumberInRange, ///< Number is in the range. + CPTPlotRangeComparisonResultNumberAboveRange ///< Number is above the range. } CPTPlotRangeComparisonResult; @interface CPTPlotRange : NSObject { - @private - NSDecimal location; - NSDecimal length; - double locationDouble; - double lengthDouble; + @private + NSDecimal location; + NSDecimal length; + double locationDouble; + double lengthDouble; } /// @name Range Limits @@ -36,30 +35,32 @@ CPTPlotRangeComparisonResult; @property (nonatomic, readonly) double minLimitDouble; @property (nonatomic, readonly) double midPointDouble; @property (nonatomic, readonly) double maxLimitDouble; -/// @} +/// @} /// @name Factory Methods /// @{ +(id)plotRangeWithLocation:(NSDecimal)loc length:(NSDecimal)len; -/// @} +/// @} /// @name Initialization /// @{ -(id)initWithLocation:(NSDecimal)loc length:(NSDecimal)len; -/// @} +/// @} /// @name Checking Ranges /// @{ -(BOOL)contains:(NSDecimal)number; -(BOOL)containsDouble:(double)number; -(BOOL)isEqualToRange:(CPTPlotRange *)otherRange; -/// @} +-(BOOL)containsRange:(CPTPlotRange *)otherRange; +-(BOOL)intersectsRange:(CPTPlotRange *)otherRange; +/// @} /// @name Range Comparison /// @{ -(CPTPlotRangeComparisonResult)compareToNumber:(NSNumber *)number; -(CPTPlotRangeComparisonResult)compareToDecimal:(NSDecimal)number; -(CPTPlotRangeComparisonResult)compareToDouble:(double)number; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTPlotSpace.h b/ios/CorePlot/CorePlotHeaders/CPTPlotSpace.h index e84dd21..36c8632 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPlotSpace.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPlotSpace.h @@ -9,18 +9,18 @@ /// @name Plot Space /// @{ -/** @brief Plot space coordinate change notification. +/** @brief Plot space coordinate change notification. * - * This notification is posted to the default notification center whenever the mapping between - * the plot space coordinate system and drawing coordinates changes. - * @ingroup notification + * This notification is posted to the default notification center whenever the mapping between + * the plot space coordinate system and drawing coordinates changes. + * @ingroup notification **/ extern NSString *const CPTPlotSpaceCoordinateMappingDidChangeNotification; /// @} /** - * @brief Plot space delegate. + * @brief Plot space delegate. **/ @protocol CPTPlotSpaceDelegate @@ -29,11 +29,11 @@ extern NSString *const CPTPlotSpaceCoordinateMappingDidChangeNotification; /// @name Scaling /// @{ -/** @brief (Optional) Informs the receiver that it should uniformly scale (e.g., in response to a pinch on iOS). +/** @brief @optional Informs the receiver that it should uniformly scale (e.g., in response to a pinch gesture). * @param space The plot space. * @param interactionScale The scaling factor. * @param interactionPoint The coordinates of the scaling centroid. - * @return YES should be returned if the gesture should be handled by the plot space, and NO to prevent handling. + * @return @YES if the gesture should be handled by the plot space, and @NO if not. * In either case, the delegate may choose to take extra actions, or handle the scaling itself. **/ -(BOOL)plotSpace:(CPTPlotSpace *)space shouldScaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint; @@ -43,10 +43,10 @@ extern NSString *const CPTPlotSpaceCoordinateMappingDidChangeNotification; /// @name Scrolling /// @{ -/** @brief (Optional) Notifies that plot space is going to scroll. - * @param space The plot space. +/** @brief @optional Notifies that plot space is going to scroll. + * @param space The plot space. * @param proposedDisplacementVector The proposed amount by which the plot space will shift. - * @return The displacement actually applied. + * @return The displacement actually applied. **/ -(CGPoint)plotSpace:(CPTPlotSpace *)space willDisplaceBy:(CGPoint)proposedDisplacementVector; @@ -55,16 +55,16 @@ extern NSString *const CPTPlotSpaceCoordinateMappingDidChangeNotification; /// @name Plot Range Changes /// @{ -/** @brief (Optional) Notifies that plot space is going to change a plot range. - * @param space The plot space. +/** @brief @optional Notifies that plot space is going to change a plot range. + * @param space The plot space. * @param newRange The proposed new plot range. * @param coordinate The coordinate of the range. - * @return The new plot range to be used. + * @return The new plot range to be used. **/ -(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate; -/** @brief (Optional) Notifies that plot space has changed a plot range. - * @param space The plot space. +/** @brief @optional Notifies that plot space has changed a plot range. + * @param space The plot space. * @param coordinate The coordinate of the range. **/ -(void)plotSpace:(CPTPlotSpace *)space didChangePlotRangeForCoordinate:(CPTCoordinate)coordinate; @@ -74,40 +74,40 @@ extern NSString *const CPTPlotSpaceCoordinateMappingDidChangeNotification; /// @name User Interaction /// @{ -/** @brief (Optional) Notifies that plot space intercepted a device down event. - * @param space The plot space. - * @param event The native event (e.g., UIEvent on iPhone) +/** @brief @optional Notifies that plot space intercepted a device down event. + * @param space The plot space. + * @param event The native event. * @param point The point in the host view. - * @return Whether the plot space should handle the event or not. + * @return Whether the plot space should handle the event or not. * In either case, the delegate may choose to take extra actions, or handle the scaling itself. **/ --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(id)event atPoint:(CGPoint)point; +-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point; -/** @brief (Optional) Notifies that plot space intercepted a device dragged event. - * @param space The plot space. - * @param event The native event (e.g., UIEvent on iPhone) +/** @brief @optional Notifies that plot space intercepted a device dragged event. + * @param space The plot space. + * @param event The native event. * @param point The point in the host view. - * @return Whether the plot space should handle the event or not. + * @return Whether the plot space should handle the event or not. * In either case, the delegate may choose to take extra actions, or handle the scaling itself. **/ --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(id)event atPoint:(CGPoint)point; +-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point; -/** @brief (Optional) Notifies that plot space intercepted a device cancelled event. - * @param space The plot space. - * @param event The native event (e.g., UIEvent on iPhone) - * @return Whether the plot space should handle the event or not. +/** @brief @optional Notifies that plot space intercepted a device cancelled event. + * @param space The plot space. + * @param event The native event. + * @return Whether the plot space should handle the event or not. * In either case, the delegate may choose to take extra actions, or handle the scaling itself. **/ --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceCancelledEvent:(id)event; +-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceCancelledEvent:(CPTNativeEvent *)event; -/** @brief (Optional) Notifies that plot space intercepted a device up event. - * @param space The plot space. - * @param event The native event (e.g., UIEvent on iPhone) +/** @brief @optional Notifies that plot space intercepted a device up event. + * @param space The plot space. + * @param event The native event. * @param point The point in the host view. - * @return Whether the plot space should handle the event or not. + * @return Whether the plot space should handle the event or not. * In either case, the delegate may choose to take extra actions, or handle the scaling itself. **/ --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(id)event atPoint:(CGPoint)point; +-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point; /// @} @@ -116,11 +116,11 @@ extern NSString *const CPTPlotSpaceCoordinateMappingDidChangeNotification; #pragma mark - @interface CPTPlotSpace : NSObject { - @private - __cpt_weak CPTGraph *graph; - id identifier; - __cpt_weak id delegate; - BOOL allowsUserInteraction; + @private + __cpt_weak CPTGraph *graph; + id identifier; + __cpt_weak id delegate; + BOOL allowsUserInteraction; } @property (nonatomic, readwrite, copy) id identifier; @@ -128,39 +128,57 @@ extern NSString *const CPTPlotSpaceCoordinateMappingDidChangeNotification; @property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTGraph *graph; @property (nonatomic, readwrite, cpt_weak_property) __cpt_weak id delegate; +@property (nonatomic, readonly) NSUInteger numberOfCoordinates; + @end #pragma mark - -/** @category CPTPlotSpace(AbstractMethods) - * @brief CPTPlotSpace abstract methods—must be overridden by subclasses +/** @category CPTPlotSpace(AbstractMethods) + * @brief CPTPlotSpace abstract methods—must be overridden by subclasses **/ @interface CPTPlotSpace(AbstractMethods) /// @name Coordinate Space Conversions /// @{ --(CGPoint)plotAreaViewPointForPlotPoint:(NSDecimal *)plotPoint; --(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(double *)plotPoint; --(void)plotPoint:(NSDecimal *)plotPoint forPlotAreaViewPoint:(CGPoint)point; --(void)doublePrecisionPlotPoint:(double *)plotPoint forPlotAreaViewPoint:(CGPoint)point; -/// @} +-(CGPoint)plotAreaViewPointForPlotPoint:(NSDecimal *)plotPoint cpt_deprecated; +-(CGPoint)plotAreaViewPointForPlotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count; + +-(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(double *)plotPoint cpt_deprecated; +-(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInteger)count; + +-(void)plotPoint:(NSDecimal *)plotPoint forPlotAreaViewPoint:(CGPoint)point cpt_deprecated; +-(void)plotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point; + +-(void)doublePrecisionPlotPoint:(double *)plotPoint forPlotAreaViewPoint:(CGPoint)point cpt_deprecated; +-(void)doublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point; + +-(CGPoint)plotAreaViewPointForEvent:(CPTNativeEvent *)event; + +-(void)plotPoint:(NSDecimal *)plotPoint forEvent:(CPTNativeEvent *)event cpt_deprecated; +-(void)plotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(CPTNativeEvent *)event; + +-(void)doublePrecisionPlotPoint:(double *)plotPoint forEvent:(CPTNativeEvent *)event cpt_deprecated; +-(void)doublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(CPTNativeEvent *)event; +/// @} /// @name Coordinate Range /// @{ -(void)setPlotRange:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate; -(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coordinate; -/// @} +/// @} /// @name Scale Types /// @{ -(void)setScaleType:(CPTScaleType)newType forCoordinate:(CPTCoordinate)coordinate; -(CPTScaleType)scaleTypeForCoordinate:(CPTCoordinate)coordinate; -/// @} +/// @} /// @name Adjusting Ranges /// @{ -(void)scaleToFitPlots:(NSArray *)plots; +-(void)scaleToFitPlots:(NSArray *)plots forCoordinate:(CPTCoordinate)coordinate; -(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTPlotSpaceAnnotation.h b/ios/CorePlot/CorePlotHeaders/CPTPlotSpaceAnnotation.h index 28a3c64..9dc7942 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPlotSpaceAnnotation.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPlotSpaceAnnotation.h @@ -1,11 +1,11 @@ #import "CPTAnnotation.h" -#import @class CPTPlotSpace; @interface CPTPlotSpaceAnnotation : CPTAnnotation { - NSArray *anchorPlotPoint; - CPTPlotSpace *plotSpace; + @private + NSArray *anchorPlotPoint; + CPTPlotSpace *plotSpace; } @property (nonatomic, readwrite, copy) NSArray *anchorPlotPoint; diff --git a/ios/CorePlot/CorePlotHeaders/CPTPlotSymbol.h b/ios/CorePlot/CorePlotHeaders/CPTPlotSymbol.h index 69cdf48..7493325 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTPlotSymbol.h +++ b/ios/CorePlot/CorePlotHeaders/CPTPlotSymbol.h @@ -1,6 +1,3 @@ -#import -#import - /// @file @class CPTLineStyle; @@ -8,38 +5,41 @@ @class CPTShadow; /** - * @brief Plot symbol types. + * @brief Plot symbol types. **/ typedef enum _CPTPlotSymbolType { - CPTPlotSymbolTypeNone, ///< No symbol. - CPTPlotSymbolTypeRectangle, ///< Rectangle symbol. - CPTPlotSymbolTypeEllipse, ///< Elliptical symbol. - CPTPlotSymbolTypeDiamond, ///< Diamond symbol. - CPTPlotSymbolTypeTriangle, ///< Triangle symbol. - CPTPlotSymbolTypeStar, ///< 5-point star symbol. - CPTPlotSymbolTypePentagon, ///< Pentagon symbol. - CPTPlotSymbolTypeHexagon, ///< Hexagon symbol. - CPTPlotSymbolTypeCross, ///< X symbol. - CPTPlotSymbolTypePlus, ///< Plus symbol. - CPTPlotSymbolTypeDash, ///< Dash symbol. - CPTPlotSymbolTypeSnow, ///< Snowflake symbol. - CPTPlotSymbolTypeCustom ///< Custom symbol. + CPTPlotSymbolTypeNone, ///< No symbol. + CPTPlotSymbolTypeRectangle, ///< Rectangle symbol. + CPTPlotSymbolTypeEllipse, ///< Elliptical symbol. + CPTPlotSymbolTypeDiamond, ///< Diamond symbol. + CPTPlotSymbolTypeTriangle, ///< Triangle symbol. + CPTPlotSymbolTypeStar, ///< 5-point star symbol. + CPTPlotSymbolTypePentagon, ///< Pentagon symbol. + CPTPlotSymbolTypeHexagon, ///< Hexagon symbol. + CPTPlotSymbolTypeCross, ///< X symbol. + CPTPlotSymbolTypePlus, ///< Plus symbol. + CPTPlotSymbolTypeDash, ///< Dash symbol. + CPTPlotSymbolTypeSnow, ///< Snowflake symbol. + CPTPlotSymbolTypeCustom ///< Custom symbol. } CPTPlotSymbolType; @interface CPTPlotSymbol : NSObject { - @private - CGSize size; - CPTPlotSymbolType symbolType; - CPTLineStyle *lineStyle; - CPTFill *fill; - CGPathRef cachedSymbolPath; - CGPathRef customSymbolPath; - BOOL usesEvenOddClipRule; - CGLayerRef cachedLayer; - CPTShadow *shadow; + @private + CGPoint anchorPoint; + CGSize size; + CPTPlotSymbolType symbolType; + CPTLineStyle *lineStyle; + CPTFill *fill; + CGPathRef cachedSymbolPath; + CGPathRef customSymbolPath; + BOOL usesEvenOddClipRule; + CGLayerRef cachedLayer; + CGFloat cachedScale; + CPTShadow *shadow; } +@property (nonatomic, readwrite, assign) CGPoint anchorPoint; @property (nonatomic, readwrite, assign) CGSize size; @property (nonatomic, readwrite, assign) CPTPlotSymbolType symbolType; @property (nonatomic, readwrite, retain) CPTLineStyle *lineStyle; @@ -63,12 +63,12 @@ CPTPlotSymbolType; +(CPTPlotSymbol *)dashPlotSymbol; +(CPTPlotSymbol *)snowPlotSymbol; +(CPTPlotSymbol *)customPlotSymbolWithPath:(CGPathRef)aPath; -/// @} +/// @} /// @name Drawing /// @{ --(void)renderInContext:(CGContextRef)theContext atPoint:(CGPoint)center scale:(CGFloat)scale alignToPixels:(BOOL)alignToPixels; --(void)renderAsVectorInContext:(CGContextRef)theContext atPoint:(CGPoint)center scale:(CGFloat)scale; -/// @} +-(void)renderInContext:(CGContextRef)context atPoint:(CGPoint)center scale:(CGFloat)scale alignToPixels:(BOOL)alignToPixels; +-(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center scale:(CGFloat)scale; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTRangePlot.h b/ios/CorePlot/CorePlotHeaders/CPTRangePlot.h index 78befa2..a23a7f0 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTRangePlot.h +++ b/ios/CorePlot/CorePlotHeaders/CPTRangePlot.h @@ -1,50 +1,127 @@ #import "CPTDefinitions.h" #import "CPTPlot.h" -#import @class CPTLineStyle; @class CPTFill; +@class CPTRangePlot; -/// @ingroup plotBindingsRangePlot -/// @{ +/// @ingroup plotBindingsRangePlot +/// @{ extern NSString *const CPTRangePlotBindingXValues; extern NSString *const CPTRangePlotBindingYValues; extern NSString *const CPTRangePlotBindingHighValues; extern NSString *const CPTRangePlotBindingLowValues; extern NSString *const CPTRangePlotBindingLeftValues; extern NSString *const CPTRangePlotBindingRightValues; -/// @} +extern NSString *const CPTRangePlotBindingBarLineStyles; +/// @} /** - * @brief Enumeration of range plot data source field types + * @brief Enumeration of range plot data source field types **/ typedef enum _CPTRangePlotField { - CPTRangePlotFieldX, ///< X values. - CPTRangePlotFieldY, ///< Y values. - CPTRangePlotFieldHigh, ///< relative High values. - CPTRangePlotFieldLow, ///< relative Low values. - CPTRangePlotFieldLeft, ///< relative Left values. - CPTRangePlotFieldRight, ///< relative Right values. + CPTRangePlotFieldX, ///< X values. + CPTRangePlotFieldY, ///< Y values. + CPTRangePlotFieldHigh, ///< relative High values. + CPTRangePlotFieldLow, ///< relative Low values. + CPTRangePlotFieldLeft, ///< relative Left values. + CPTRangePlotFieldRight, ///< relative Right values. } CPTRangePlotField; +#pragma mark - + +/** + * @brief A range plot data source. + **/ +@protocol CPTRangePlotDataSource +@optional + +/// @name Bar Style +/// @{ + +/** @brief @optional Gets a range of bar line styles for the given range plot. + * @param plot The range plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of line styles. + **/ +-(NSArray *)barLineStylesForRangePlot:(CPTRangePlot *)plot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets a bar line style for the given range plot. + * This method will not be called if + * @link CPTRangePlotDataSource::barLineStylesForRangePlot:recordIndexRange: -barLineStylesForRangePlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The range plot. + * @param idx The data index of interest. + * @return The bar line style for the bar with the given index. If the data source returns @nil, the default line style is used. + * If the data source returns an NSNull object, no line is drawn. + **/ +-(CPTLineStyle *)barLineStyleForRangePlot:(CPTRangePlot *)plot recordIndex:(NSUInteger)idx; + +/// @} + +@end + +#pragma mark - + +/** + * @brief Range plot delegate. + **/ +@protocol CPTRangePlotDelegate + +@optional + +/// @name Point Selection +/// @{ + +/** @brief @optional Informs the delegate that a bar was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The range plot. + * @param idx The index of the + * @if MacOnly clicked bar. @endif + * @if iOSOnly touched bar. @endif + **/ +-(void)rangePlot:(CPTRangePlot *)plot rangeWasSelectedAtRecordIndex:(NSUInteger)idx; + +/** @brief @optional Informs the delegate that a bar was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The range plot. + * @param idx The index of the + * @if MacOnly clicked bar. @endif + * @if iOSOnly touched bar. @endif + * @param event The event that triggered the selection. + **/ +-(void)rangePlot:(CPTRangePlot *)plot rangeWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; + +/// @} + +@end + +#pragma mark - + @interface CPTRangePlot : CPTPlot { - CPTLineStyle *barLineStyle; - CGFloat barWidth; - CGFloat gapHeight; - CGFloat gapWidth; - CPTFill *areaFill; + @private + CPTLineStyle *barLineStyle; + CGFloat barWidth; + CGFloat gapHeight; + CGFloat gapWidth; + CPTFill *areaFill; } -/// @name Bar Appearance +/// @name Appearance /// @{ @property (nonatomic, readwrite, copy) CPTLineStyle *barLineStyle; -@property (nonatomic, readwrite) CGFloat barWidth, gapHeight, gapWidth; -/// @} +@property (nonatomic, readwrite) CGFloat barWidth; +@property (nonatomic, readwrite) CGFloat gapHeight; +@property (nonatomic, readwrite) CGFloat gapWidth; +/// @} -/// @name Area Fill +/// @name Drawing /// @{ @property (nonatomic, copy) CPTFill *areaFill; +@property (nonatomic, readwrite, copy) CPTLineStyle *areaBorderLineStyle; /// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTResponder.h b/ios/CorePlot/CorePlotHeaders/CPTResponder.h index e5f390f..caf16d7 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTResponder.h +++ b/ios/CorePlot/CorePlotHeaders/CPTResponder.h @@ -1,8 +1,7 @@ -#import -#import +#import "CPTPlatformSpecificDefines.h" /** - * @brief The basis of all event processing in Core Plot. + * @brief The basis of all event processing in Core Plot. **/ @protocol CPTResponder @@ -10,44 +9,44 @@ /// @{ /** - * @brief (Required) Informs the receiver that the user has - * @if MacOnly pressed the mouse button. @endif - * @if iOSOnly touched the screen. @endif - * @param event The OS event. - * @param interactionPoint The coordinates of the interaction. + * @brief @required Informs the receiver that the user has + * @if MacOnly pressed the mouse button. @endif + * @if iOSOnly touched the screen. @endif + * @param event The OS event. + * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(id)event atPoint:(CGPoint)interactionPoint; +-(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint; /** - * @brief (Required) Informs the receiver that the user has - * @if MacOnly released the mouse button. @endif - * @if iOSOnly lifted their finger off the screen. @endif - * @param event The OS event. - * @param interactionPoint The coordinates of the interaction. + * @brief @required Informs the receiver that the user has + * @if MacOnly released the mouse button. @endif + * @if iOSOnly lifted their finger off the screen. @endif + * @param event The OS event. + * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(id)event atPoint:(CGPoint)interactionPoint; +-(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint; /** - * @brief (Required) Informs the receiver that the user has moved - * @if MacOnly the mouse with the button pressed. @endif - * @if iOSOnly their finger while touching the screen. @endif - * @param event The OS event. - * @param interactionPoint The coordinates of the interaction. + * @brief @required Informs the receiver that the user has moved + * @if MacOnly the mouse with the button pressed. @endif + * @if iOSOnly their finger while touching the screen. @endif + * @param event The OS event. + * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDraggedEvent:(id)event atPoint:(CGPoint)interactionPoint; +-(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint; /** - * @brief (Required) Informs the receiver that tracking of - * @if MacOnly mouse moves @endif - * @if iOSOnly touches @endif - * has been cancelled for any reason. - * @param event The OS event. + * @brief @required Informs the receiver that tracking of + * @if MacOnly mouse moves @endif + * @if iOSOnly touches @endif + * has been cancelled for any reason. + * @param event The OS event. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceCancelledEvent:(id)event; -/// @} +-(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTScatterPlot.h b/ios/CorePlot/CorePlotHeaders/CPTScatterPlot.h index f8b88b9..3b36130 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTScatterPlot.h +++ b/ios/CorePlot/CorePlotHeaders/CPTScatterPlot.h @@ -1,8 +1,7 @@ #import "CPTDefinitions.h" #import "CPTPlot.h" -#import -/// @file +/// @file @class CPTLineStyle; @class CPTMutableNumericData; @@ -11,36 +10,37 @@ @class CPTScatterPlot; @class CPTFill; -/// @ingroup plotBindingsScatterPlot +/// @ingroup plotBindingsScatterPlot /// @{ extern NSString *const CPTScatterPlotBindingXValues; extern NSString *const CPTScatterPlotBindingYValues; extern NSString *const CPTScatterPlotBindingPlotSymbols; -/// @} +/// @} /** - * @brief Enumeration of scatter plot data source field types + * @brief Enumeration of scatter plot data source field types **/ typedef enum _CPTScatterPlotField { - CPTScatterPlotFieldX, ///< X values. - CPTScatterPlotFieldY ///< Y values. + CPTScatterPlotFieldX, ///< X values. + CPTScatterPlotFieldY ///< Y values. } CPTScatterPlotField; /** - * @brief Enumeration of scatter plot interpolation algorithms + * @brief Enumeration of scatter plot interpolation algorithms **/ typedef enum _CPTScatterPlotInterpolation { - CPTScatterPlotInterpolationLinear, ///< Linear interpolation. - CPTScatterPlotInterpolationStepped, ///< Steps beginnning at data point. - CPTScatterPlotInterpolationHistogram ///< Steps centered at data point. + CPTScatterPlotInterpolationLinear, ///< Linear interpolation. + CPTScatterPlotInterpolationStepped, ///< Steps beginning at data point. + CPTScatterPlotInterpolationHistogram, ///< Steps centered at data point. + CPTScatterPlotInterpolationCurved ///< Bezier curve interpolation. } CPTScatterPlotInterpolation; #pragma mark - /** - * @brief A scatter plot data source. + * @brief A scatter plot data source. **/ @protocol CPTScatterPlotDataSource @@ -49,82 +49,107 @@ CPTScatterPlotInterpolation; /// @name Plot Symbols /// @{ -/** @brief (Optional) Gets a range of plot symbols for the given scatter plot. - * @param plot The scatter plot. - * @param indexRange The range of the data indexes of interest. - * @return An array of plot symbols. +/** @brief @optional Gets a range of plot symbols for the given scatter plot. + * @param plot The scatter plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of plot symbols. **/ -(NSArray *)symbolsForScatterPlot:(CPTScatterPlot *)plot recordIndexRange:(NSRange)indexRange; -/** @brief (Optional) Gets a single plot symbol for the given scatter plot. - * This method will not be called if - * @link CPTScatterPlotDataSource::symbolsForScatterPlot:recordIndexRange: -symbolsForScatterPlot:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param plot The scatter plot. - * @param index The data index of interest. - * @return The plot symbol to show for the point with the given index. +/** @brief @optional Gets a single plot symbol for the given scatter plot. + * This method will not be called if + * @link CPTScatterPlotDataSource::symbolsForScatterPlot:recordIndexRange: -symbolsForScatterPlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The scatter plot. + * @param idx The data index of interest. + * @return The plot symbol to show for the point with the given index. **/ --(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUInteger)index; +-(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUInteger)idx; -/// @} +/// @} @end #pragma mark - /** - * @brief Scatter plot delegate. + * @brief Scatter plot delegate. **/ -@protocol CPTScatterPlotDelegate +@protocol CPTScatterPlotDelegate @optional -/// @name Point Selection +/// @name Point Selection /// @{ -/** @brief (Optional) Informs delegate that a point was touched. - * @param plot The scatter plot. - * @param index Index of touched point +/** @brief @optional Informs the delegate that a data point was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The scatter plot. + * @param idx The index of the + * @if MacOnly clicked data point. @endif + * @if iOSOnly touched data point. @endif **/ --(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index; +-(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)idx; + +/** @brief @optional Informs the delegate that a data point was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The scatter plot. + * @param idx The index of the + * @if MacOnly clicked data point. @endif + * @if iOSOnly touched data point. @endif + * @param event The event that triggered the selection. + **/ +-(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; -/// @} +/// @} @end #pragma mark - @interface CPTScatterPlot : CPTPlot { - @private - CPTScatterPlotInterpolation interpolation; - CPTLineStyle *dataLineStyle; - CPTPlotSymbol *plotSymbol; - CPTFill *areaFill; - CPTFill *areaFill2; - NSDecimal areaBaseValue; - NSDecimal areaBaseValue2; - CGFloat plotSymbolMarginForHitDetection; - NSArray *plotSymbols; + @private + CPTScatterPlotInterpolation interpolation; + CPTLineStyle *dataLineStyle; + CPTPlotSymbol *plotSymbol; + CPTFill *areaFill; + CPTFill *areaFill2; + NSDecimal areaBaseValue; + NSDecimal areaBaseValue2; + CGFloat plotSymbolMarginForHitDetection; } +/// @name Appearance +/// @{ +@property (nonatomic, readwrite) NSDecimal areaBaseValue; +@property (nonatomic, readwrite) NSDecimal areaBaseValue2; +@property (nonatomic, readwrite, assign) CPTScatterPlotInterpolation interpolation; +/// @} + +/// @name Drawing +/// @{ @property (nonatomic, readwrite, copy) CPTLineStyle *dataLineStyle; @property (nonatomic, readwrite, copy) CPTPlotSymbol *plotSymbol; @property (nonatomic, readwrite, copy) CPTFill *areaFill; @property (nonatomic, readwrite, copy) CPTFill *areaFill2; -@property (nonatomic, readwrite) NSDecimal areaBaseValue; -@property (nonatomic, readwrite) NSDecimal areaBaseValue2; -@property (nonatomic, readwrite, assign) CPTScatterPlotInterpolation interpolation; +/// @} + +/// @name User Interaction +/// @{ @property (nonatomic, readwrite, assign) CGFloat plotSymbolMarginForHitDetection; +/// @} -/// @name Visible Points -/// @{ +/// @name Visible Points +/// @{ -(NSUInteger)indexOfVisiblePointClosestToPlotAreaPoint:(CGPoint)viewPoint; --(CGPoint)plotAreaPointOfVisiblePointAtIndex:(NSUInteger)index; -/// @} +-(CGPoint)plotAreaPointOfVisiblePointAtIndex:(NSUInteger)idx; +/// @} -/// @name Plot Symbols -/// @{ --(CPTPlotSymbol *)plotSymbolForRecordIndex:(NSUInteger)index; -/// @} +/// @name Plot Symbols +/// @{ +-(CPTPlotSymbol *)plotSymbolForRecordIndex:(NSUInteger)idx; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTShadow.h b/ios/CorePlot/CorePlotHeaders/CPTShadow.h index 76093f9..ea69441 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTShadow.h +++ b/ios/CorePlot/CorePlotHeaders/CPTShadow.h @@ -1,13 +1,10 @@ -#import -#import - @class CPTColor; @interface CPTShadow : NSObject { - @private - CGSize shadowOffset; - CGFloat shadowBlurRadius; - CPTColor *shadowColor; + @private + CGSize shadowOffset; + CGFloat shadowBlurRadius; + CPTColor *shadowColor; } @property (nonatomic, readonly, assign) CGSize shadowOffset; @@ -17,11 +14,11 @@ /// @name Factory Methods /// @{ +(id)shadow; -/// @} +/// @} /// @name Drawing /// @{ --(void)setShadowInContext:(CGContextRef)theContext; -/// @} +-(void)setShadowInContext:(CGContextRef)context; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTTestCase.h b/ios/CorePlot/CorePlotHeaders/CPTTestCase.h new file mode 100644 index 0000000..122fd91 --- /dev/null +++ b/ios/CorePlot/CorePlotHeaders/CPTTestCase.h @@ -0,0 +1,6 @@ +#import + +@interface CPTTestCase : SenTestCase { +} + +@end diff --git a/ios/CorePlot/CorePlotHeaders/CPTTextLayer.h b/ios/CorePlot/CorePlotHeaders/CPTTextLayer.h index 5676c97..eccaef7 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTTextLayer.h +++ b/ios/CorePlot/CorePlotHeaders/CPTTextLayer.h @@ -1,29 +1,34 @@ -#import "CPTLayer.h" +#import "CPTBorderedLayer.h" #import "CPTTextStyle.h" -/// @file +/// @file extern const CGFloat kCPTTextLayerMarginWidth; ///< Margin width around the text. -@interface CPTTextLayer : CPTLayer { - @private - NSString *text; - CPTTextStyle *textStyle; +@interface CPTTextLayer : CPTBorderedLayer { + @private + NSString *text; + CPTTextStyle *textStyle; + NSAttributedString *attributedText; + CGSize maximumSize; } @property (readwrite, copy, nonatomic) NSString *text; @property (readwrite, retain, nonatomic) CPTTextStyle *textStyle; +@property (readwrite, copy, nonatomic) NSAttributedString *attributedText; +@property (readwrite, nonatomic) CGSize maximumSize; /// @name Initialization /// @{ -(id)initWithText:(NSString *)newText; -(id)initWithText:(NSString *)newText style:(CPTTextStyle *)newStyle; -/// @} +-(id)initWithAttributedText:(NSAttributedString *)newText; +/// @} /// @name Layout /// @{ -(CGSize)sizeThatFits; -(void)sizeToFit; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTTextStyle.h b/ios/CorePlot/CorePlotHeaders/CPTTextStyle.h index eb0b47e..be28017 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTTextStyle.h +++ b/ios/CorePlot/CorePlotHeaders/CPTTextStyle.h @@ -1,53 +1,60 @@ -#import -#import - -/// @file +#include "CPTTextStylePlatformSpecific.h" @class CPTColor; -/** - * @brief Enumeration of paragraph alignments. - **/ -typedef enum _CPTTextAlignment { - CPTTextAlignmentLeft, ///< Left alignment - CPTTextAlignmentCenter, ///< Center alignment - CPTTextAlignmentRight ///< Right alignment -} -CPTTextAlignment; - @interface CPTTextStyle : NSObject { - @protected - NSString *fontName; - CGFloat fontSize; - CPTColor *color; - CPTTextAlignment textAlignment; + @protected + NSString *fontName; + CGFloat fontSize; + CPTColor *color; + CPTTextAlignment textAlignment; + NSLineBreakMode lineBreakMode; } @property (readonly, copy, nonatomic) NSString *fontName; @property (readonly, assign, nonatomic) CGFloat fontSize; @property (readonly, copy, nonatomic) CPTColor *color; @property (readonly, assign, nonatomic) CPTTextAlignment textAlignment; +@property (readonly, assign, nonatomic) NSLineBreakMode lineBreakMode; /// @name Factory Methods /// @{ +(id)textStyle; -/// @} +/// @} + +@end + +#pragma mark - + +/** @category CPTTextStyle(CPTPlatformSpecificTextStyleExtensions) + * @brief Platform-specific extensions to CPTTextStyle. + **/ +@interface CPTTextStyle(CPTPlatformSpecificTextStyleExtensions) + +@property (readonly, copy, nonatomic) NSDictionary *attributes; + +/// @name Factory Methods +/// @{ ++(id)textStyleWithAttributes:(NSDictionary *)attributes; +/// @} @end -/** @category NSString(CPTTextStyleExtensions) - * @brief NSString extensions for drawing styled text. +#pragma mark - + +/** @category NSString(CPTTextStyleExtensions) + * @brief NSString extensions for drawing styled text. **/ @interface NSString(CPTTextStyleExtensions) /// @name Measurement /// @{ -(CGSize)sizeWithTextStyle:(CPTTextStyle *)style; -/// @} +/// @} /// @name Drawing /// @{ -(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CGContextRef)context; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTTextStylePlatformSpecific.h b/ios/CorePlot/CorePlotHeaders/CPTTextStylePlatformSpecific.h new file mode 100644 index 0000000..6674dd2 --- /dev/null +++ b/ios/CorePlot/CorePlotHeaders/CPTTextStylePlatformSpecific.h @@ -0,0 +1,28 @@ +/// @file + +/** + * @brief Enumeration of paragraph alignments. + **/ +typedef enum _CPTTextAlignment { + CPTTextAlignmentLeft = NSTextAlignmentLeft, ///< Left alignment. + CPTTextAlignmentCenter = NSTextAlignmentCenter, ///< Center alignment. + CPTTextAlignmentRight = NSTextAlignmentRight, ///< Right alignment. + CPTTextAlignmentJustified = NSTextAlignmentJustified, ///< Justified alignment. + CPTTextAlignmentNatural = NSTextAlignmentNatural ///< Natural alignment of the text's script. +} +CPTTextAlignment; + +// @cond +// for iOS SDK compatibility +#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000 +@interface NSString(CPTTextStylePlatformSpecificExtensions) + +-(CGSize)sizeWithAttributes:(NSDictionary *)attrs; + +@end +#else +#endif +#endif + +/// @endcond diff --git a/ios/CorePlot/CorePlotHeaders/CPTTheme.h b/ios/CorePlot/CorePlotHeaders/CPTTheme.h index 619da67..ccf174e 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTTheme.h +++ b/ios/CorePlot/CorePlotHeaders/CPTTheme.h @@ -1,12 +1,10 @@ -#import - -/// @ingroup themeNames +/// @ingroup themeNames /// @{ -extern NSString *const kCPTDarkGradientTheme; -extern NSString *const kCPTPlainBlackTheme; -extern NSString *const kCPTPlainWhiteTheme; -extern NSString *const kCPTSlateTheme; -extern NSString *const kCPTStocksTheme; +extern NSString *const kCPTDarkGradientTheme; ///< A graph theme with dark gray gradient backgrounds and light gray lines. +extern NSString *const kCPTPlainBlackTheme; ///< A graph theme with black backgrounds and white lines. +extern NSString *const kCPTPlainWhiteTheme; ///< A graph theme with white backgrounds and black lines. +extern NSString *const kCPTSlateTheme; ///< A graph theme with colors that match the default iPhone navigation bar, toolbar buttons, and table views. +extern NSString *const kCPTStocksTheme; ///< A graph theme with a gradient background and white lines. /// @} @class CPTGraph; @@ -15,8 +13,8 @@ extern NSString *const kCPTStocksTheme; @class CPTMutableTextStyle; @interface CPTTheme : NSObject { - @private - Class graphClass; + @private + Class graphClass; } @property (nonatomic, readwrite, retain) Class graphClass; @@ -36,8 +34,8 @@ extern NSString *const kCPTStocksTheme; @end -/** @category CPTTheme(AbstractMethods) - * @brief CPTTheme abstract methods—must be overridden by subclasses +/** @category CPTTheme(AbstractMethods) + * @brief CPTTheme abstract methods—must be overridden by subclasses **/ @interface CPTTheme(AbstractMethods) diff --git a/ios/CorePlot/CorePlotHeaders/CPTTimeFormatter.h b/ios/CorePlot/CorePlotHeaders/CPTTimeFormatter.h index 8dacbb2..155a51e 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTTimeFormatter.h +++ b/ios/CorePlot/CorePlotHeaders/CPTTimeFormatter.h @@ -1,19 +1,17 @@ -#import - -/// @file +/// @file @interface CPTTimeFormatter : NSNumberFormatter { - @private - NSDateFormatter *dateFormatter; - NSDate *referenceDate; + @private + NSDateFormatter *dateFormatter; + NSDate *referenceDate; } @property (nonatomic, readwrite, retain) NSDateFormatter *dateFormatter; @property (nonatomic, readwrite, copy) NSDate *referenceDate; -/// @name Initialization -/// @{ +/// @name Initialization +/// @{ -(id)initWithDateFormatter:(NSDateFormatter *)aDateFormatter; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTTradingRangePlot.h b/ios/CorePlot/CorePlotHeaders/CPTTradingRangePlot.h index 085334c..a3e8964 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTTradingRangePlot.h +++ b/ios/CorePlot/CorePlotHeaders/CPTTradingRangePlot.h @@ -1,8 +1,7 @@ #import "CPTDefinitions.h" #import "CPTPlot.h" -#import -/// @file +/// @file @class CPTLineStyle; @class CPTMutableNumericData; @@ -10,61 +9,219 @@ @class CPTTradingRangePlot; @class CPTFill; -/// @ingroup plotBindingsTradingRangePlot +/// @ingroup plotBindingsTradingRangePlot /// @{ extern NSString *const CPTTradingRangePlotBindingXValues; extern NSString *const CPTTradingRangePlotBindingOpenValues; extern NSString *const CPTTradingRangePlotBindingHighValues; extern NSString *const CPTTradingRangePlotBindingLowValues; extern NSString *const CPTTradingRangePlotBindingCloseValues; -/// @} +extern NSString *const CPTTradingRangePlotBindingIncreaseFills; +extern NSString *const CPTTradingRangePlotBindingDecreaseFills; +extern NSString *const CPTTradingRangePlotBindingLineStyles; +extern NSString *const CPTTradingRangePlotBindingIncreaseLineStyles; +extern NSString *const CPTTradingRangePlotBindingDecreaseLineStyles; +/// @} /** - * @brief Enumeration of Quote plot render style types. + * @brief Enumeration of Quote plot render style types. **/ typedef enum _CPTTradingRangePlotStyle { - CPTTradingRangePlotStyleOHLC, ///< Open-High-Low-Close (OHLC) plot. - CPTTradingRangePlotStyleCandleStick ///< Candlestick plot. + CPTTradingRangePlotStyleOHLC, ///< Open-High-Low-Close (OHLC) plot. + CPTTradingRangePlotStyleCandleStick ///< Candlestick plot. } CPTTradingRangePlotStyle; /** - * @brief Enumeration of Quote plot data source field types. + * @brief Enumeration of Quote plot data source field types. **/ typedef enum _CPTTradingRangePlotField { - CPTTradingRangePlotFieldX, ///< X values. - CPTTradingRangePlotFieldOpen, ///< Open values. - CPTTradingRangePlotFieldHigh, ///< High values. - CPTTradingRangePlotFieldLow, ///< Low values. - CPTTradingRangePlotFieldClose ///< Close values. + CPTTradingRangePlotFieldX, ///< X values. + CPTTradingRangePlotFieldOpen, ///< Open values. + CPTTradingRangePlotFieldHigh, ///< High values. + CPTTradingRangePlotFieldLow, ///< Low values. + CPTTradingRangePlotFieldClose ///< Close values. } CPTTradingRangePlotField; #pragma mark - +/** + * @brief A trading range plot data source. + **/ +@protocol CPTTradingRangePlotDataSource +@optional + +/// @name Bar Fills +/// @{ + +/** @brief @optional Gets a range of fills used with a candlestick plot when close >= open for the given plot. + * @param plot The trading range plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of fills. + **/ +-(NSArray *)increaseFillsForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets the fill used with a candlestick plot when close >= open for the given plot. + * This method will not be called if + * @link CPTTradingRangePlotDataSource::increaseFillsForTradingRangePlot:recordIndexRange: -increaseFillsForTradingRangePlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The trading range plot. + * @param idx The data index of interest. + * @return The bar fill for the bar with the given index. If the data source returns @nil, the default increase fill is used. + * If the data source returns an NSNull object, no fill is drawn. + **/ +-(CPTFill *)increaseFillForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; + +/** @brief @optional Gets a range of fills used with a candlestick plot when close < open for the given plot. + * @param plot The trading range plot. + * @param indexRange The range of the data indexes of interest. + **/ +-(NSArray *)decreaseFillsForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets the fill used with a candlestick plot when close < open for the given plot. + * This method will not be called if + * @link CPTTradingRangePlotDataSource::decreaseFillsForTradingRangePlot:recordIndexRange: -decreaseFillsForTradingRangePlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The trading range plot. + * @param idx The data index of interest. + * @return The bar fill for the bar with the given index. If the data source returns @nil, the default decrease fill is used. + * If the data source returns an NSNull object, no fill is drawn. + **/ +-(CPTFill *)decreaseFillForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; + +/// @} + +/// @name Bar Line Styles +/// @{ + +/** @brief @optional Gets a range of line styles used to draw candlestick or OHLC symbols for the given trading range plot. + * @param plot The trading range plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of line styles. + **/ +-(NSArray *)lineStylesForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets the line style used to draw candlestick or OHLC symbols for the given trading range plot. + * This method will not be called if + * @link CPTTradingRangePlotDataSource::lineStylesForTradingRangePlot:recordIndexRange: -lineStylesForTradingRangePlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The trading range plot. + * @param idx The data index of interest. + * @return The line style for the symbol with the given index. If the data source returns @nil, the default line style is used. + * If the data source returns an NSNull object, no line is drawn. + **/ +-(CPTLineStyle *)lineStyleForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; + +/** @brief @optional Gets a range of line styles used to outline candlestick symbols when close >= open for the given trading range plot. + * @param plot The trading range plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of line styles. + **/ +-(NSArray *)increaseLineStylesForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets the line style used to outline candlestick symbols when close >= open for the given trading range plot. + * This method will not be called if + * @link CPTTradingRangePlotDataSource::increaseLineStylesForTradingRangePlot:recordIndexRange: -increaseLineStylesForTradingRangePlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The trading range plot. + * @param idx The data index of interest. + * @return The line line style for the symbol with the given index. If the data source returns @nil, the default increase line style is used. + * If the data source returns an NSNull object, no line is drawn. + **/ +-(CPTLineStyle *)increaseLineStyleForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; + +/** @brief @optional Gets a range of line styles used to outline candlestick symbols when close < open for the given trading range plot. + * @param plot The trading range plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of line styles. + **/ +-(NSArray *)decreaseLineStylesForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets the line style used to outline candlestick symbols when close < open for the given trading range plot. + * This method will not be called if + * @link CPTTradingRangePlotDataSource::decreaseLineStylesForTradingRangePlot:recordIndexRange: -decreaseLineStylesForTradingRangePlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The trading range plot. + * @param idx The data index of interest. + * @return The line line style for the symbol with the given index. If the data source returns @nil, the default decrease line style is used. + * If the data source returns an NSNull object, no line is drawn. + **/ +-(CPTLineStyle *)decreaseLineStyleForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; + +/// @} + +@end + +#pragma mark - + +/** + * @brief Trading range plot delegate. + **/ +@protocol CPTTradingRangePlotDelegate + +@optional + +/// @name Point Selection +/// @{ + +/** @brief @optional Informs the delegate that a bar was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The trading range plot. + * @param idx The index of the + * @if MacOnly clicked bar. @endif + * @if iOSOnly touched bar. @endif + **/ +-(void)tradingRangePlot:(CPTTradingRangePlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx; + +/** @brief @optional Informs the delegate that a bar was + * @if MacOnly clicked. @endif + * @if iOSOnly touched. @endif + * @param plot The trading range plot. + * @param idx The index of the + * @if MacOnly clicked bar. @endif + * @if iOSOnly touched bar. @endif + * @param event The event that triggered the selection. + **/ +-(void)tradingRangePlot:(CPTTradingRangePlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; + +/// @} + +@end + +#pragma mark - + @interface CPTTradingRangePlot : CPTPlot { - @private - CPTLineStyle *lineStyle; - CPTLineStyle *increaseLineStyle; - CPTLineStyle *decreaseLineStyle; - CPTFill *increaseFill; - CPTFill *decreaseFill; - - CPTTradingRangePlotStyle plotStyle; - - CGFloat barWidth; - CGFloat stickLength; - CGFloat barCornerRadius; + @private + CPTLineStyle *lineStyle; + CPTLineStyle *increaseLineStyle; + CPTLineStyle *decreaseLineStyle; + CPTFill *increaseFill; + CPTFill *decreaseFill; + + CPTTradingRangePlotStyle plotStyle; + + CGFloat barWidth; + CGFloat stickLength; + CGFloat barCornerRadius; } +/// @name Appearance +/// @{ +@property (nonatomic, readwrite, assign) CPTTradingRangePlotStyle plotStyle; +@property (nonatomic, readwrite, assign) CGFloat barWidth; // In view coordinates +@property (nonatomic, readwrite, assign) CGFloat stickLength; // In view coordinates +@property (nonatomic, readwrite, assign) CGFloat barCornerRadius; +/// @} + +/// @name Drawing +/// @{ @property (nonatomic, readwrite, copy) CPTLineStyle *lineStyle; @property (nonatomic, readwrite, copy) CPTLineStyle *increaseLineStyle; @property (nonatomic, readwrite, copy) CPTLineStyle *decreaseLineStyle; @property (nonatomic, readwrite, copy) CPTFill *increaseFill; @property (nonatomic, readwrite, copy) CPTFill *decreaseFill; -@property (nonatomic, readwrite, assign) CPTTradingRangePlotStyle plotStyle; -@property (nonatomic, readwrite, assign) CGFloat barWidth; // In view coordinates -@property (nonatomic, readwrite, assign) CGFloat stickLength; // In view coordinates -@property (nonatomic, readwrite, assign) CGFloat barCornerRadius; +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTUtilities.h b/ios/CorePlot/CorePlotHeaders/CPTUtilities.h index 763ad8c..f21d04f 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTUtilities.h +++ b/ios/CorePlot/CorePlotHeaders/CPTUtilities.h @@ -1,8 +1,9 @@ #import "CPTDefinitions.h" -#import /// @file +@class CPTLineStyle; + #if __cplusplus extern "C" { #endif @@ -33,10 +34,10 @@ NSString *CPTDecimalStringValue(NSDecimal decimalNumber); /// @name Convert Primitive Types to NSDecimal /// @{ -NSDecimal CPTDecimalFromChar(int8_t i); -NSDecimal CPTDecimalFromShort(int16_t i); -NSDecimal CPTDecimalFromLong(int32_t i); -NSDecimal CPTDecimalFromLongLong(int64_t i); +NSDecimal CPTDecimalFromChar(int8_t anInt); +NSDecimal CPTDecimalFromShort(int16_t anInt); +NSDecimal CPTDecimalFromLong(int32_t anInt); +NSDecimal CPTDecimalFromLongLong(int64_t anInt); NSDecimal CPTDecimalFromInt(int i); NSDecimal CPTDecimalFromInteger(NSInteger i); @@ -47,9 +48,9 @@ NSDecimal CPTDecimalFromUnsignedLongLong(uint64_t i); NSDecimal CPTDecimalFromUnsignedInt(unsigned int i); NSDecimal CPTDecimalFromUnsignedInteger(NSUInteger i); -NSDecimal CPTDecimalFromFloat(float f); -NSDecimal CPTDecimalFromDouble(double d); -NSDecimal CPTDecimalFromCGFloat(CGFloat f); +NSDecimal CPTDecimalFromFloat(float aFloat); +NSDecimal CPTDecimalFromDouble(double aDouble); +NSDecimal CPTDecimalFromCGFloat(CGFloat aCGFloat); NSDecimal CPTDecimalFromString(NSString *stringRepresentation); @@ -77,6 +78,9 @@ BOOL CPTDecimalEquals(NSDecimal leftOperand, NSDecimal rightOperand); /// @name NSDecimal Utilities /// @{ NSDecimal CPTDecimalNaN(void); +NSDecimal CPTDecimalMin(NSDecimal leftOperand, NSDecimal rightOperand); +NSDecimal CPTDecimalMax(NSDecimal leftOperand, NSDecimal rightOperand); +NSDecimal CPTDecimalAbs(NSDecimal value); /// @} @@ -100,19 +104,39 @@ CPTRGBAColor CPTRGBAColorFromCGColor(CGColorRef color); /// @name Quartz Pixel-Alignment Functions /// @{ -CGPoint CPTAlignPointToUserSpace(CGContextRef context, CGPoint p); -CGSize CPTAlignSizeToUserSpace(CGContextRef context, CGSize s); -CGRect CPTAlignRectToUserSpace(CGContextRef context, CGRect r); -CGPoint CPTAlignIntegralPointToUserSpace(CGContextRef context, CGPoint p); +/** + * @brief A function called to align a point in a CGContext. + **/ +typedef CGPoint (*CPTAlignPointFunction)(CGContextRef, CGPoint); + +/** + * @brief A function called to align a rectangle in a CGContext. + **/ +typedef CGRect (*CPTAlignRectFunction)(CGContextRef, CGRect); + +CGPoint CPTAlignPointToUserSpace(CGContextRef context, CGPoint point); +CGSize CPTAlignSizeToUserSpace(CGContextRef context, CGSize size); +CGRect CPTAlignRectToUserSpace(CGContextRef context, CGRect rect); + +CGPoint CPTAlignIntegralPointToUserSpace(CGContextRef context, CGPoint point); +CGRect CPTAlignIntegralRectToUserSpace(CGContextRef context, CGRect rect); + +CGRect CPTAlignBorderedRectToUserSpace(CGContextRef context, CGRect rect, CPTLineStyle *borderLineStyle); /// @} /// @name String Formatting for Core Graphics Structs /// @{ -NSString *CPTStringFromPoint(CGPoint p); -NSString *CPTStringFromSize(CGSize s); -NSString *CPTStringFromRect(CGRect r); +NSString *CPTStringFromPoint(CGPoint point); +NSString *CPTStringFromSize(CGSize size); +NSString *CPTStringFromRect(CGRect rect); + +/// @} + +/// @name CGPoint Utilities +/// @{ +CGFloat squareOfDistanceBetweenPoints(CGPoint point1, CGPoint point2); /// @} diff --git a/ios/CorePlot/CorePlotHeaders/CPTXYAxis.h b/ios/CorePlot/CorePlotHeaders/CPTXYAxis.h index 0a7dbc1..b11f477 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTXYAxis.h +++ b/ios/CorePlot/CorePlotHeaders/CPTXYAxis.h @@ -1,18 +1,17 @@ #import "CPTAxis.h" -#import @class CPTConstraints; @interface CPTXYAxis : CPTAxis { - @private - NSDecimal orthogonalCoordinateDecimal; - CPTConstraints *axisConstraints; + @private + NSDecimal orthogonalCoordinateDecimal; + CPTConstraints *axisConstraints; } /// @name Positioning /// @{ @property (nonatomic, readwrite) NSDecimal orthogonalCoordinateDecimal; @property (nonatomic, readwrite, retain) CPTConstraints *axisConstraints; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTXYAxisSet.h b/ios/CorePlot/CorePlotHeaders/CPTXYAxisSet.h index 82c63d3..0254c26 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTXYAxisSet.h +++ b/ios/CorePlot/CorePlotHeaders/CPTXYAxisSet.h @@ -1,5 +1,4 @@ #import "CPTAxisSet.h" -#import @class CPTXYAxis; diff --git a/ios/CorePlot/CorePlotHeaders/CPTXYGraph.h b/ios/CorePlot/CorePlotHeaders/CPTXYGraph.h index 913b6ef..5bd29b0 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTXYGraph.h +++ b/ios/CorePlot/CorePlotHeaders/CPTXYGraph.h @@ -1,16 +1,15 @@ #import "CPTDefinitions.h" #import "CPTGraph.h" -#import @interface CPTXYGraph : CPTGraph { - @private - CPTScaleType xScaleType; - CPTScaleType yScaleType; + @private + CPTScaleType xScaleType; + CPTScaleType yScaleType; } /// @name Initialization /// @{ -(id)initWithFrame:(CGRect)newFrame xScaleType:(CPTScaleType)newXScaleType yScaleType:(CPTScaleType)newYScaleType; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/CPTXYPlotSpace.h b/ios/CorePlot/CorePlotHeaders/CPTXYPlotSpace.h index 7780f21..7040d78 100644 --- a/ios/CorePlot/CorePlotHeaders/CPTXYPlotSpace.h +++ b/ios/CorePlot/CorePlotHeaders/CPTXYPlotSpace.h @@ -1,18 +1,29 @@ +#import "CPTAnimation.h" #import "CPTDefinitions.h" #import "CPTPlotSpace.h" @class CPTPlotRange; -@interface CPTXYPlotSpace : CPTPlotSpace { - @private - CPTPlotRange *xRange; - CPTPlotRange *yRange; - CPTPlotRange *globalXRange; - CPTPlotRange *globalYRange; - CPTScaleType xScaleType; - CPTScaleType yScaleType; - CGPoint lastDragPoint; - BOOL isDragging; +@interface CPTXYPlotSpace : CPTPlotSpace { + @private + CPTPlotRange *xRange; + CPTPlotRange *yRange; + CPTPlotRange *globalXRange; + CPTPlotRange *globalYRange; + CPTScaleType xScaleType; + CPTScaleType yScaleType; + CGPoint lastDragPoint; + CGPoint lastDisplacement; + NSTimeInterval lastDragTime; + NSTimeInterval lastDeltaTime; + BOOL isDragging; + BOOL allowsMomentumX; + BOOL allowsMomentumY; + NSMutableArray *animations; + CPTAnimationCurve momentumAnimationCurve; + CPTAnimationCurve bounceAnimationCurve; + CGFloat momentumAcceleration; + CGFloat bounceAcceleration; } @property (nonatomic, readwrite, copy) CPTPlotRange *xRange; @@ -22,4 +33,12 @@ @property (nonatomic, readwrite, assign) CPTScaleType xScaleType; @property (nonatomic, readwrite, assign) CPTScaleType yScaleType; +@property (nonatomic, readwrite) BOOL allowsMomentum; +@property (nonatomic, readwrite) BOOL allowsMomentumX; +@property (nonatomic, readwrite) BOOL allowsMomentumY; +@property (nonatomic, readwrite) CPTAnimationCurve momentumAnimationCurve; +@property (nonatomic, readwrite) CPTAnimationCurve bounceAnimationCurve; +@property (nonatomic, readwrite) CGFloat momentumAcceleration; +@property (nonatomic, readwrite) CGFloat bounceAcceleration; + @end diff --git a/ios/CorePlot/CorePlotHeaders/CorePlot-CocoaTouch.h b/ios/CorePlot/CorePlotHeaders/CorePlot-CocoaTouch.h index e39c026..9be2b42 100644 --- a/ios/CorePlot/CorePlotHeaders/CorePlot-CocoaTouch.h +++ b/ios/CorePlot/CorePlotHeaders/CorePlot-CocoaTouch.h @@ -1,3 +1,9 @@ +#import +#import + +#import "CPTAnimation.h" +#import "CPTAnimationOperation.h" +#import "CPTAnimationPeriod.h" #import "CPTAnnotation.h" #import "CPTAnnotationHostLayer.h" #import "CPTAxis.h" @@ -6,12 +12,14 @@ #import "CPTAxisTitle.h" #import "CPTBarPlot.h" #import "CPTBorderedLayer.h" +#import "CPTCalendarFormatter.h" #import "CPTColor.h" #import "CPTColorSpace.h" #import "CPTConstraints.h" #import "CPTDefinitions.h" #import "CPTExceptions.h" #import "CPTFill.h" +#import "CPTFunctionDataSource.h" #import "CPTGradient.h" #import "CPTGraph.h" #import "CPTGraphHostingView.h" diff --git a/ios/CorePlot/CorePlotHeaders/NSCoderExtensions.h b/ios/CorePlot/CorePlotHeaders/NSCoderExtensions.h index c73cff1..eab4af3 100644 --- a/ios/CorePlot/CorePlotHeaders/NSCoderExtensions.h +++ b/ios/CorePlot/CorePlotHeaders/NSCoderExtensions.h @@ -1,8 +1,5 @@ -#import -#import - -/** @category NSCoder(CPTExtensions) - * @brief Core Plot extensions to NSCoder. +/** @category NSCoder(CPTExtensions) + * @brief Core Plot extensions to NSCoder. **/ @interface NSCoder(CPTExtensions) @@ -18,7 +15,7 @@ -(void)encodeCGImage:(CGImageRef)image forKey:(NSString *)key; -(void)encodeDecimal:(NSDecimal)number forKey:(NSString *)key; -/// @} +/// @} /// @name Decoding Data /// @{ @@ -32,6 +29,6 @@ -(CGImageRef)newCGImageDecodeForKey:(NSString *)key; -(NSDecimal)decodeDecimalForKey:(NSString *)key; -/// @} +/// @} @end diff --git a/ios/CorePlot/CorePlotHeaders/NSDecimalNumberExtensions.h b/ios/CorePlot/CorePlotHeaders/NSDecimalNumberExtensions.h index 0ee0687..d0e48e8 100644 --- a/ios/CorePlot/CorePlotHeaders/NSDecimalNumberExtensions.h +++ b/ios/CorePlot/CorePlotHeaders/NSDecimalNumberExtensions.h @@ -1,8 +1,5 @@ -#import -#import - -/** @category NSDecimalNumber(CPTExtensions) - * @brief Core Plot extensions to NSDecimalNumber. +/** @category NSDecimalNumber(CPTExtensions) + * @brief Core Plot extensions to NSDecimalNumber. **/ @interface NSDecimalNumber(CPTExtensions) diff --git a/ios/CorePlot/CorePlotHeaders/NSNumberExtensions.h b/ios/CorePlot/CorePlotHeaders/NSNumberExtensions.h index fdefdfb..16dbd7c 100644 --- a/ios/CorePlot/CorePlotHeaders/NSNumberExtensions.h +++ b/ios/CorePlot/CorePlotHeaders/NSNumberExtensions.h @@ -1,8 +1,5 @@ -#import -#import - -/** @category NSNumber(CPTExtensions) - * @brief Core Plot extensions to NSNumber. +/** @category NSNumber(CPTExtensions) + * @brief Core Plot extensions to NSNumber. **/ @interface NSNumber(CPTExtensions) diff --git a/ios/CorePlot/CorePlotHeaders/_CPTConstraintsFixed.h b/ios/CorePlot/CorePlotHeaders/_CPTConstraintsFixed.h deleted file mode 100644 index ddb4eb7..0000000 --- a/ios/CorePlot/CorePlotHeaders/_CPTConstraintsFixed.h +++ /dev/null @@ -1,26 +0,0 @@ -#import "CPTConstraints.h" -#import - -@interface _CPTConstraintsFixed : CPTConstraints { - @private - CGFloat offset; - BOOL isFixedToLower; -} - -/// @name Initialization -/// @{ --(id)initWithLowerOffset:(CGFloat)newOffset; --(id)initWithUpperOffset:(CGFloat)newOffset; -/// @} - -/// @name Comparison -/// @{ --(BOOL)isEqualToConstraint:(CPTConstraints *)otherConstraint; -/// @} - -/// @name Position -/// @{ --(CGFloat)positionForLowerBound:(CGFloat)lowerBound upperBound:(CGFloat)upperBound; -/// @} - -@end diff --git a/ios/CorePlot/CorePlotHeaders/_CPTConstraintsRelative.h b/ios/CorePlot/CorePlotHeaders/_CPTConstraintsRelative.h deleted file mode 100644 index 8191a05..0000000 --- a/ios/CorePlot/CorePlotHeaders/_CPTConstraintsRelative.h +++ /dev/null @@ -1,24 +0,0 @@ -#import "CPTConstraints.h" -#import - -@interface _CPTConstraintsRelative : CPTConstraints { - @private - CGFloat offset; -} - -/// @name Initialization -/// @{ --(id)initWithRelativeOffset:(CGFloat)newOffset; -/// @} - -/// @name Comparison -/// @{ --(BOOL)isEqualToConstraint:(CPTConstraints *)otherConstraint; -/// @} - -/// @name Position -/// @{ --(CGFloat)positionForLowerBound:(CGFloat)lowerBound upperBound:(CGFloat)upperBound; -/// @} - -@end diff --git a/ios/CorePlot/CorePlotHeaders/_CPTDarkGradientTheme.h b/ios/CorePlot/CorePlotHeaders/_CPTDarkGradientTheme.h deleted file mode 100644 index 7d6e784..0000000 --- a/ios/CorePlot/CorePlotHeaders/_CPTDarkGradientTheme.h +++ /dev/null @@ -1,6 +0,0 @@ -#import "_CPTXYTheme.h" - -@interface _CPTDarkGradientTheme : _CPTXYTheme { -} - -@end diff --git a/ios/CorePlot/CorePlotHeaders/_CPTFillColor.h b/ios/CorePlot/CorePlotHeaders/_CPTFillColor.h deleted file mode 100644 index b9264df..0000000 --- a/ios/CorePlot/CorePlotHeaders/_CPTFillColor.h +++ /dev/null @@ -1,20 +0,0 @@ -#import "CPTFill.h" -#import - -@interface _CPTFillColor : CPTFill { - @private - CPTColor *fillColor; -} - -/// @name Initialization -/// @{ --(id)initWithColor:(CPTColor *)aCcolor; -/// @} - -/// @name Drawing -/// @{ --(void)fillRect:(CGRect)theRect inContext:(CGContextRef)theContext; --(void)fillPathInContext:(CGContextRef)theContext; -/// @} - -@end diff --git a/ios/CorePlot/CorePlotHeaders/_CPTFillGradient.h b/ios/CorePlot/CorePlotHeaders/_CPTFillGradient.h deleted file mode 100644 index 31f7263..0000000 --- a/ios/CorePlot/CorePlotHeaders/_CPTFillGradient.h +++ /dev/null @@ -1,22 +0,0 @@ -#import "CPTFill.h" -#import - -@class CPTGradient; - -@interface _CPTFillGradient : CPTFill { - @private - CPTGradient *fillGradient; -} - -/// @name Initialization -/// @{ --(id)initWithGradient:(CPTGradient *)aGradient; -/// @} - -/// @name Drawing -/// @{ --(void)fillRect:(CGRect)theRect inContext:(CGContextRef)theContext; --(void)fillPathInContext:(CGContextRef)theContext; -/// @} - -@end diff --git a/ios/CorePlot/CorePlotHeaders/_CPTFillImage.h b/ios/CorePlot/CorePlotHeaders/_CPTFillImage.h deleted file mode 100644 index 5f1ca59..0000000 --- a/ios/CorePlot/CorePlotHeaders/_CPTFillImage.h +++ /dev/null @@ -1,22 +0,0 @@ -#import "CPTFill.h" -#import - -@class CPTImage; - -@interface _CPTFillImage : CPTFill { - @private - CPTImage *fillImage; -} - -/// @name Initialization -/// @{ --(id)initWithImage:(CPTImage *)anImage; -/// @} - -/// @name Drawing -/// @{ --(void)fillRect:(CGRect)theRect inContext:(CGContextRef)theContext; --(void)fillPathInContext:(CGContextRef)theContext; -/// @} - -@end diff --git a/ios/CorePlot/CorePlotHeaders/_CPTPlainBlackTheme.h b/ios/CorePlot/CorePlotHeaders/_CPTPlainBlackTheme.h deleted file mode 100644 index 46d25c3..0000000 --- a/ios/CorePlot/CorePlotHeaders/_CPTPlainBlackTheme.h +++ /dev/null @@ -1,6 +0,0 @@ -#import "_CPTXYTheme.h" - -@interface _CPTPlainBlackTheme : _CPTXYTheme { -} - -@end diff --git a/ios/CorePlot/CorePlotHeaders/_CPTPlainWhiteTheme.h b/ios/CorePlot/CorePlotHeaders/_CPTPlainWhiteTheme.h deleted file mode 100644 index 5375648..0000000 --- a/ios/CorePlot/CorePlotHeaders/_CPTPlainWhiteTheme.h +++ /dev/null @@ -1,6 +0,0 @@ -#import "_CPTXYTheme.h" - -@interface _CPTPlainWhiteTheme : _CPTXYTheme { -} - -@end diff --git a/ios/CorePlot/CorePlotHeaders/_CPTSlateTheme.h b/ios/CorePlot/CorePlotHeaders/_CPTSlateTheme.h deleted file mode 100644 index ea3acba..0000000 --- a/ios/CorePlot/CorePlotHeaders/_CPTSlateTheme.h +++ /dev/null @@ -1,6 +0,0 @@ -#import "_CPTXYTheme.h" - -@interface _CPTSlateTheme : _CPTXYTheme { -} - -@end diff --git a/ios/CorePlot/CorePlotHeaders/_CPTStocksTheme.h b/ios/CorePlot/CorePlotHeaders/_CPTStocksTheme.h deleted file mode 100644 index 298917b..0000000 --- a/ios/CorePlot/CorePlotHeaders/_CPTStocksTheme.h +++ /dev/null @@ -1,6 +0,0 @@ -#import "_CPTXYTheme.h" - -@interface _CPTStocksTheme : _CPTXYTheme { -} - -@end diff --git a/ios/CorePlot/CorePlotHeaders/_CPTXYTheme.h b/ios/CorePlot/CorePlotHeaders/_CPTXYTheme.h deleted file mode 100644 index 0ba57a9..0000000 --- a/ios/CorePlot/CorePlotHeaders/_CPTXYTheme.h +++ /dev/null @@ -1,6 +0,0 @@ -#import "CPTTheme.h" - -@interface _CPTXYTheme : CPTTheme { -} - -@end diff --git a/ios/CorePlot/CorePlotHeaders/mainpage.h b/ios/CorePlot/CorePlotHeaders/mainpage.h new file mode 100644 index 0000000..b4e1287 --- /dev/null +++ b/ios/CorePlot/CorePlotHeaders/mainpage.h @@ -0,0 +1,74 @@ +/*! @mainpage Core Plot + * + * @section intro Introduction + * + * Core Plot is a 2D plotting framework for Mac OS X and iOS. + * It is highly customizable and capable of drawing many types of plots. + * See the Example Graphs + * wiki page and the example applications + * for examples of some of its capabilities. + * + * @section start Getting Started + * + * See the High Level Design Overview + * wiki for an overview of Core Plot's architecture and the + * Using Core Plot in an Application + * wiki for information on how to use Core Plot in your own application. + * + * @section documentation Documentation + * + * Documentation of the Core Plot API and high-level architecture can be found in the following places: + * + * - Change log + * - API documentation for Mac + * - API documentation for iOS + * - API documentation built with Doxygen and installed locally in Xcode + * (see the instructions + * in the READMEs folder for details) + * - Project Wiki on GitHub + * - Documentation folder in the code repository + * + * @section wheretoaskforhelp Where to Ask For Help + * + * @subsection qasites Q&A Sites + * + * - Core Plot Google Group + * - Stackoverflow.com core-plot tag + * + * @subsection socialnetworks Social Networks + * + * - Twitter + * - App.net; Subscribe to the Announcements broadcast. + * + * @section contributingtocoreplot Contributing to Core Plot + * + * Core Plot is an open source project hosted on GitHub. + * There are two code repositories under the main project: + * + * - core-plot: This is main code repository with the framework and all examples. + * This is where you will find the release packages, wiki pages, and issue tracker. + * - core-plot.github.io: This is the HTML API documentation. + * You can view the pages online at http://core-plot.github.io. + * + * @subsection codingstandards Coding Standards + * + * Everyone has a their own preferred coding style, and no one way can be considered right. + * Nonetheless, in a project like Core Plot, with many developers contributing, it is worthwhile + * defining a set of basic coding standards to prevent a mishmash of different styles which can + * become frustrating when navigating the code base. See the file + * Coding Style.markdown + * found in the documentation + * directory of the project source for specific guidelines. + * + * Core Plot includes a script + * to run Uncrustify on the source code to standardize the formatting. + * All source code will be formatted with this tool before being committed to the Core Plot repository. + * + * @subsection testing Testing + * + * Because Core Plot is intended to be used in scientific, financial, and other domains where correctness is paramount, + * unit testing is integrated into the framework. Good test coverage protects developers from introducing accidental + * regressions and frees them to experiment and refactor without fear of breaking things. See the + * unit testing wiki page for instructions + * on how to build unit tests for any new code you add to the project. + */ diff --git a/ios/CorePlot/libCorePlot-CocoaTouch.a b/ios/CorePlot/libCorePlot-CocoaTouch.a index e0dc4e9..a7a1508 100644 Binary files a/ios/CorePlot/libCorePlot-CocoaTouch.a and b/ios/CorePlot/libCorePlot-CocoaTouch.a differ diff --git a/ios/documentation/changelog.md b/ios/documentation/changelog.md index 35b2de0..d0ce92c 100644 --- a/ios/documentation/changelog.md +++ b/ios/documentation/changelog.md @@ -1,5 +1,7 @@ # Change Log
+v1.5.1  [TIMOB-18092] Updated Core-Plot library to include x86_64
+
 v1.5.0  [TIMOB-18092] Updated to build for 64bit
 
 v1.4.1  [MOD-1120] Building with 2.1.3.GA and open sourcing
diff --git a/ios/manifest b/ios/manifest
index dfa0fb9..1695ec2 100644
--- a/ios/manifest
+++ b/ios/manifest
@@ -2,7 +2,7 @@
 # this is your module manifest and used by Titanium
 # during compilation, packaging, distribution, etc.
 #
-version: 1.5.0
+version: 1.5.1
 apiversion: 2
 architectures: armv7 i386 x86_64 arm64
 description: Chart Module
diff --git a/ios/ti.charts-iphone-1.4.1.zip b/ios/ti.charts-iphone-1.4.1.zip
deleted file mode 100644
index 0034ae5..0000000
Binary files a/ios/ti.charts-iphone-1.4.1.zip and /dev/null differ