Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
谢俊逸 committed Apr 20, 2017
1 parent 483ce75 commit e043c4f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#define animationDuration 3


typedef enum : NSUInteger {
Positive,
Negative,
} Valuence;


@interface XPositiveNegativeBarContainerView ()
@property (nonatomic, strong) CABasicAnimation *pathAnimation;

Expand Down Expand Up @@ -163,9 +169,9 @@ - (void)strokeChart {
CAShapeLayer *fillRectShapeLayer;

if (self.dataNumberArray[idx].doubleValue >= 0) {
fillRectShapeLayer = [self rectAnimationLayerWithBounds:fillRect fillColor:self.dataItemArray[idx].color Valuence:0];
fillRectShapeLayer = [self rectAnimationLayerWithBounds:fillRect fillColor:self.dataItemArray[idx].color Valuence:Positive];
} else {
fillRectShapeLayer = [self rectAnimationLayerWithBounds:fillRect fillColor:self.dataItemArray[idx].color Valuence:1];
fillRectShapeLayer = [self rectAnimationLayerWithBounds:fillRect fillColor:self.dataItemArray[idx].color Valuence:Negative];
}


Expand Down Expand Up @@ -241,14 +247,14 @@ - (CAShapeLayer *)rectAnimationLayerWithBounds:(CGRect)rect fillColor:(UIColor *
return chartLine;
}

- (CAShapeLayer *)rectAnimationLayerWithBounds:(CGRect)rect fillColor:(UIColor *)fillColor Valuence:(BOOL)valyence {
- (CAShapeLayer *)rectAnimationLayerWithBounds:(CGRect)rect fillColor:(UIColor *)fillColor Valuence:(Valuence)valyence {

CGPoint startPoint;
CGPoint endPoint;
CGPoint temStartPoint;
CGPoint temEndPoint;
BOOL canAnimation = YES;
if (valyence == 0) {
if (valyence == Positive) {
//矩形中一条线path
startPoint = CGPointMake(rect.origin.x + (rect.size.width) / 2, (rect.origin.y + rect.size.height));
endPoint = CGPointMake(rect.origin.x + (rect.size.width) / 2, (rect.origin.y));
Expand Down
14 changes: 10 additions & 4 deletions XJYChart/XPositiveNegativeBarContainerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#define animationDuration 3


typedef enum : NSUInteger {
Positive,
Negative,
} Valuence;


@interface XPositiveNegativeBarContainerView ()
@property (nonatomic, strong) CABasicAnimation *pathAnimation;

Expand Down Expand Up @@ -163,9 +169,9 @@ - (void)strokeChart {
CAShapeLayer *fillRectShapeLayer;

if (self.dataNumberArray[idx].doubleValue >= 0) {
fillRectShapeLayer = [self rectAnimationLayerWithBounds:fillRect fillColor:self.dataItemArray[idx].color Valuence:0];
fillRectShapeLayer = [self rectAnimationLayerWithBounds:fillRect fillColor:self.dataItemArray[idx].color Valuence:Positive];
} else {
fillRectShapeLayer = [self rectAnimationLayerWithBounds:fillRect fillColor:self.dataItemArray[idx].color Valuence:1];
fillRectShapeLayer = [self rectAnimationLayerWithBounds:fillRect fillColor:self.dataItemArray[idx].color Valuence:Negative];
}


Expand Down Expand Up @@ -241,14 +247,14 @@ - (CAShapeLayer *)rectAnimationLayerWithBounds:(CGRect)rect fillColor:(UIColor *
return chartLine;
}

- (CAShapeLayer *)rectAnimationLayerWithBounds:(CGRect)rect fillColor:(UIColor *)fillColor Valuence:(BOOL)valyence {
- (CAShapeLayer *)rectAnimationLayerWithBounds:(CGRect)rect fillColor:(UIColor *)fillColor Valuence:(Valuence)valyence {

CGPoint startPoint;
CGPoint endPoint;
CGPoint temStartPoint;
CGPoint temEndPoint;
BOOL canAnimation = YES;
if (valyence == 0) {
if (valyence == Positive) {
//矩形中一条线path
startPoint = CGPointMake(rect.origin.x + (rect.size.width) / 2, (rect.origin.y + rect.size.height));
endPoint = CGPointMake(rect.origin.x + (rect.size.width) / 2, (rect.origin.y));
Expand Down

0 comments on commit e043c4f

Please sign in to comment.