Merge pull request #211 from dullgrass/master
Add the new feature that supports show the negative numbers
Showing
8 changed files
with
171 additions
and
77 deletions
| @@ -11,9 +11,12 @@ | @@ -11,9 +11,12 @@ | ||
| 11 | 11 | ||
| 12 | @interface PNBar : UIView | 12 | @interface PNBar : UIView |
| 13 | 13 | ||
| 14 | + | ||
| 14 | - (void)rollBack; | 15 | - (void)rollBack; |
| 15 | 16 | ||
| 16 | @property (nonatomic) float grade; | 17 | @property (nonatomic) float grade; |
| 18 | +@property (nonatomic) float maxDivisor; | ||
| 19 | + | ||
| 17 | @property (nonatomic) CAShapeLayer *chartLine; | 20 | @property (nonatomic) CAShapeLayer *chartLine; |
| 18 | @property (nonatomic) UIColor *barColor; | 21 | @property (nonatomic) UIColor *barColor; |
| 19 | @property (nonatomic) UIColor *barColorGradientStart; | 22 | @property (nonatomic) UIColor *barColorGradientStart; |
| @@ -23,5 +26,6 @@ | @@ -23,5 +26,6 @@ | ||
| 23 | @property (nonatomic) CAShapeLayer *gradeLayer; | 26 | @property (nonatomic) CAShapeLayer *gradeLayer; |
| 24 | @property (nonatomic) CATextLayer* textLayer; | 27 | @property (nonatomic) CATextLayer* textLayer; |
| 25 | 28 | ||
| 26 | - | 29 | +@property (nonatomic, assign) BOOL isNegative; //!< 是否是负数 |
| 30 | +@property (nonatomic, assign) BOOL isShowNumber; //!< 是否显示numbers | ||
| 27 | @end | 31 | @end |
| @@ -10,6 +10,12 @@ | @@ -10,6 +10,12 @@ | ||
| 10 | #import "PNColor.h" | 10 | #import "PNColor.h" |
| 11 | #import <CoreText/CoreText.h> | 11 | #import <CoreText/CoreText.h> |
| 12 | 12 | ||
| 13 | +@interface PNBar () | ||
| 14 | + | ||
| 15 | +@property (nonatomic) float copyGrade; | ||
| 16 | + | ||
| 17 | +@end | ||
| 18 | + | ||
| 13 | @implementation PNBar | 19 | @implementation PNBar |
| 14 | 20 | ||
| 15 | - (id)initWithFrame:(CGRect)frame | 21 | - (id)initWithFrame:(CGRect)frame |
| @@ -39,8 +45,7 @@ | @@ -39,8 +45,7 @@ | ||
| 39 | 45 | ||
| 40 | - (void)setGrade:(float)grade | 46 | - (void)setGrade:(float)grade |
| 41 | { | 47 | { |
| 42 | -// NSLog(@"New garde %f",grade); | 48 | + _copyGrade = grade; |
| 43 | - | ||
| 44 | CGFloat startPosY = (1 - grade) * self.frame.size.height; | 49 | CGFloat startPosY = (1 - grade) * self.frame.size.height; |
| 45 | 50 | ||
| 46 | UIBezierPath *progressline = [UIBezierPath bezierPath]; | 51 | UIBezierPath *progressline = [UIBezierPath bezierPath]; |
| @@ -76,9 +81,7 @@ | @@ -76,9 +81,7 @@ | ||
| 76 | // Add gradient | 81 | // Add gradient |
| 77 | [self.gradientMask addAnimation:pathAnimation forKey:@"animationKey"]; | 82 | [self.gradientMask addAnimation:pathAnimation forKey:@"animationKey"]; |
| 78 | self.gradientMask.path = progressline.CGPath; | 83 | self.gradientMask.path = progressline.CGPath; |
| 79 | - | 84 | + |
| 80 | - // add text | ||
| 81 | - [self setGradeFrame:grade startPosY:startPosY]; | ||
| 82 | CABasicAnimation* opacityAnimation = [self fadeAnimation]; | 85 | CABasicAnimation* opacityAnimation = [self fadeAnimation]; |
| 83 | [self.textLayer addAnimation:opacityAnimation forKey:nil]; | 86 | [self.textLayer addAnimation:opacityAnimation forKey:nil]; |
| 84 | 87 | ||
| @@ -108,13 +111,14 @@ | @@ -108,13 +111,14 @@ | ||
| 108 | 111 | ||
| 109 | 112 | ||
| 110 | CAGradientLayer *gradientLayer = [CAGradientLayer layer]; | 113 | CAGradientLayer *gradientLayer = [CAGradientLayer layer]; |
| 111 | - gradientLayer.startPoint = CGPointMake(0.5,1.0); | 114 | + gradientLayer.startPoint = CGPointMake(0.0,0.0); |
| 112 | - gradientLayer.endPoint = CGPointMake(0.5,0.0); | 115 | + gradientLayer.endPoint = CGPointMake(1.0 ,0.0); |
| 113 | gradientLayer.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height); | 116 | gradientLayer.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height); |
| 114 | - UIColor *endColor = (_barColor ? _barColor : [UIColor greenColor]); | 117 | + UIColor *middleColor = [UIColor colorWithWhite:255/255 alpha:0.8]; |
| 115 | NSArray *colors = @[ | 118 | NSArray *colors = @[ |
| 116 | - (id)_barColorGradientStart.CGColor, | 119 | + (__bridge id)self.barColor.CGColor, |
| 117 | - (id)endColor.CGColor | 120 | + (__bridge id)middleColor.CGColor, |
| 121 | + (__bridge id)self.barColor.CGColor | ||
| 118 | ]; | 122 | ]; |
| 119 | gradientLayer.colors = colors; | 123 | gradientLayer.colors = colors; |
| 120 | 124 | ||
| @@ -124,9 +128,7 @@ | @@ -124,9 +128,7 @@ | ||
| 124 | 128 | ||
| 125 | self.gradientMask.strokeEnd = 1.0; | 129 | self.gradientMask.strokeEnd = 1.0; |
| 126 | [self.gradientMask addAnimation:pathAnimation forKey:@"strokeEndAnimation"]; | 130 | [self.gradientMask addAnimation:pathAnimation forKey:@"strokeEndAnimation"]; |
| 127 | - | 131 | + |
| 128 | - //set grade | ||
| 129 | - [self setGradeFrame:grade startPosY:startPosY]; | ||
| 130 | CABasicAnimation* opacityAnimation = [self fadeAnimation]; | 132 | CABasicAnimation* opacityAnimation = [self fadeAnimation]; |
| 131 | [self.textLayer addAnimation:opacityAnimation forKey:nil]; | 133 | [self.textLayer addAnimation:opacityAnimation forKey:nil]; |
| 132 | } | 134 | } |
| @@ -179,7 +181,9 @@ | @@ -179,7 +181,9 @@ | ||
| 179 | _textLayer = [[CATextLayer alloc]init]; | 181 | _textLayer = [[CATextLayer alloc]init]; |
| 180 | [_textLayer setString:@"0"]; | 182 | [_textLayer setString:@"0"]; |
| 181 | [_textLayer setAlignmentMode:kCAAlignmentCenter]; | 183 | [_textLayer setAlignmentMode:kCAAlignmentCenter]; |
| 182 | - [_textLayer setForegroundColor:[[UIColor grayColor] CGColor]]; | 184 | + [_textLayer setForegroundColor:[[UIColor colorWithRed:178/255.0 green:178/255. blue:178/255.0 alpha:1.0] CGColor]]; |
| 185 | + _textLayer.hidden = YES; | ||
| 186 | + | ||
| 183 | } | 187 | } |
| 184 | 188 | ||
| 185 | return _textLayer; | 189 | return _textLayer; |
| @@ -187,27 +191,67 @@ | @@ -187,27 +191,67 @@ | ||
| 187 | 191 | ||
| 188 | -(void)setGradeFrame:(CGFloat)grade startPosY:(CGFloat)startPosY | 192 | -(void)setGradeFrame:(CGFloat)grade startPosY:(CGFloat)startPosY |
| 189 | { | 193 | { |
| 190 | - CGFloat textheigt = self.bounds.size.width; | 194 | + CGFloat textheigt = self.bounds.size.height*self.grade; |
| 195 | + | ||
| 196 | + CGFloat topSpace = self.bounds.size.height * (1-self.grade); | ||
| 191 | CGFloat textWidth = self.bounds.size.width; | 197 | CGFloat textWidth = self.bounds.size.width; |
| 192 | - CGFloat textStartPosY; | 198 | + |
| 193 | - | ||
| 194 | - | ||
| 195 | - if (startPosY < textheigt) { | ||
| 196 | - textStartPosY = startPosY; | ||
| 197 | - } | ||
| 198 | - else { | ||
| 199 | - textStartPosY = startPosY - textheigt; | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | [_chartLine addSublayer:self.textLayer]; | 199 | [_chartLine addSublayer:self.textLayer]; |
| 203 | - [self.textLayer setFontSize:textheigt/2]; | 200 | + [self.textLayer setFontSize:18.0]; |
| 201 | + | ||
| 202 | + [self.textLayer setString:[[NSString alloc]initWithFormat:@"%0.f",grade*self.maxDivisor]]; | ||
| 203 | + | ||
| 204 | + CGSize size = CGSizeMake(320,2000); //设置一个行高上限 | ||
| 205 | + NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:18.0]}; | ||
| 206 | + size = [self.textLayer.string boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size; | ||
| 207 | + float verticalY ; | ||
| 208 | + | ||
| 209 | + if (size.height>=textheigt) { | ||
| 210 | + | ||
| 211 | + verticalY = topSpace - size.height; | ||
| 212 | + } else { | ||
| 213 | + verticalY = topSpace + (textheigt-size.height)/2.0; | ||
| 214 | + } | ||
| 204 | 215 | ||
| 205 | - [self.textLayer setString:[[NSString alloc]initWithFormat:@"%0.f",grade*100]]; | 216 | + [self.textLayer setFrame:CGRectMake((textWidth-size.width)/2.0,verticalY, size.width,size.height)]; |
| 206 | - [self.textLayer setFrame:CGRectMake(0, textStartPosY, textWidth, textheigt)]; | ||
| 207 | self.textLayer.contentsScale = [UIScreen mainScreen].scale; | 217 | self.textLayer.contentsScale = [UIScreen mainScreen].scale; |
| 208 | 218 | ||
| 209 | } | 219 | } |
| 210 | 220 | ||
| 221 | +- (void)setIsShowNumber:(BOOL)isShowNumber{ | ||
| 222 | + if (isShowNumber) { | ||
| 223 | + self.textLayer.hidden = NO; | ||
| 224 | + [self setGradeFrame:_copyGrade startPosY:0]; | ||
| 225 | + }else{ | ||
| 226 | + self.textLayer.hidden = YES; | ||
| 227 | + } | ||
| 228 | +} | ||
| 229 | +- (void)setIsNegative:(BOOL)isNegative{ | ||
| 230 | + if (isNegative) { | ||
| 231 | + [self.textLayer setString:[[NSString alloc]initWithFormat:@"- %1.f",_grade*self.maxDivisor]]; | ||
| 232 | + | ||
| 233 | + CGSize size = CGSizeMake(320,2000); //设置一个行高上限 | ||
| 234 | + NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:18.0]}; | ||
| 235 | + size = [self.textLayer.string boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size; | ||
| 236 | + CGRect frame = self.textLayer.frame; | ||
| 237 | + frame.origin.x = (self.bounds.size.width - size.width)/2.0; | ||
| 238 | + frame.size = size; | ||
| 239 | + self.textLayer.frame = frame; | ||
| 240 | + | ||
| 241 | + CABasicAnimation* rotationAnimation; | ||
| 242 | + rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; | ||
| 243 | + rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI]; | ||
| 244 | + [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | ||
| 245 | + rotationAnimation.duration = 0.1; | ||
| 246 | + rotationAnimation.repeatCount = 0;//你可以设置到最大的整数值 | ||
| 247 | + rotationAnimation.cumulative = NO; | ||
| 248 | + rotationAnimation.removedOnCompletion = NO; | ||
| 249 | + rotationAnimation.fillMode = kCAFillModeForwards; | ||
| 250 | + [self.textLayer addAnimation:rotationAnimation forKey:@"Rotation"]; | ||
| 251 | + | ||
| 252 | + } | ||
| 253 | +} | ||
| 254 | + | ||
| 211 | -(CABasicAnimation*)fadeAnimation | 255 | -(CABasicAnimation*)fadeAnimation |
| 212 | { | 256 | { |
| 213 | CABasicAnimation* fadeAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; | 257 | CABasicAnimation* fadeAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; |
| @@ -32,7 +32,7 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue); | @@ -32,7 +32,7 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue); | ||
| 32 | @property (nonatomic) NSMutableArray * bars; | 32 | @property (nonatomic) NSMutableArray * bars; |
| 33 | 33 | ||
| 34 | @property (nonatomic) CGFloat xLabelWidth; | 34 | @property (nonatomic) CGFloat xLabelWidth; |
| 35 | -@property (nonatomic) int yValueMax; | 35 | +@property (nonatomic) float yValueMax; |
| 36 | @property (nonatomic) UIColor *strokeColor; | 36 | @property (nonatomic) UIColor *strokeColor; |
| 37 | @property (nonatomic) NSArray *strokeColors; | 37 | @property (nonatomic) NSArray *strokeColors; |
| 38 | 38 | ||
| @@ -54,9 +54,15 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue); | @@ -54,9 +54,15 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue); | ||
| 54 | /** Controls whether the chart border line should be displayed. */ | 54 | /** Controls whether the chart border line should be displayed. */ |
| 55 | @property (nonatomic) BOOL showChartBorder; | 55 | @property (nonatomic) BOOL showChartBorder; |
| 56 | 56 | ||
| 57 | +/** Controls whether the chart Horizontal separator should be displayed. */ | ||
| 58 | +@property (nonatomic, assign) BOOL showLevelLine; | ||
| 59 | + | ||
| 57 | /** Chart bottom border, co-linear with the x-axis. */ | 60 | /** Chart bottom border, co-linear with the x-axis. */ |
| 58 | @property (nonatomic) CAShapeLayer * chartBottomLine; | 61 | @property (nonatomic) CAShapeLayer * chartBottomLine; |
| 59 | 62 | ||
| 63 | +/** Chart bottom border, level separator-linear with the x-axis. */ | ||
| 64 | +@property (nonatomic) CAShapeLayer * chartLevelLine; | ||
| 65 | + | ||
| 60 | /** Chart left border, co-linear with the y-axis. */ | 66 | /** Chart left border, co-linear with the y-axis. */ |
| 61 | @property (nonatomic) CAShapeLayer * chartLeftLine; | 67 | @property (nonatomic) CAShapeLayer * chartLeftLine; |
| 62 | 68 | ||
| @@ -97,4 +103,10 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue); | @@ -97,4 +103,10 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue); | ||
| 97 | 103 | ||
| 98 | @property (nonatomic, weak) id<PNChartDelegate> delegate; | 104 | @property (nonatomic, weak) id<PNChartDelegate> delegate; |
| 99 | 105 | ||
| 106 | +/**whether show gradient bar*/ | ||
| 107 | +@property (nonatomic, assign) BOOL isGradientShow; | ||
| 108 | + | ||
| 109 | +/** whether show numbers*/ | ||
| 110 | +@property (nonatomic, assign) BOOL isShowNumbers; | ||
| 111 | + | ||
| 100 | @end | 112 | @end |
| @@ -56,12 +56,14 @@ | @@ -56,12 +56,14 @@ | ||
| 56 | _xLabelSkip = 1; | 56 | _xLabelSkip = 1; |
| 57 | _yLabelSum = 4; | 57 | _yLabelSum = 4; |
| 58 | _labelMarginTop = 0; | 58 | _labelMarginTop = 0; |
| 59 | - _chartMargin = 15.0; | 59 | + _chartMargin = 25.0; |
| 60 | _barRadius = 2.0; | 60 | _barRadius = 2.0; |
| 61 | _showChartBorder = NO; | 61 | _showChartBorder = NO; |
| 62 | + _showLevelLine = NO; | ||
| 62 | _yChartLabelWidth = 18; | 63 | _yChartLabelWidth = 18; |
| 63 | _rotateForXAxisText = false; | 64 | _rotateForXAxisText = false; |
| 64 | - | 65 | + _isGradientShow = YES; |
| 66 | + _isShowNumbers = YES; | ||
| 65 | _yLabelFormatter = ^(CGFloat yValue){ | 67 | _yLabelFormatter = ^(CGFloat yValue){ |
| 66 | return [NSString stringWithFormat:@"%1.f",yValue]; | 68 | return [NSString stringWithFormat:@"%1.f",yValue]; |
| 67 | }; | 69 | }; |
| @@ -84,6 +86,7 @@ | @@ -84,6 +86,7 @@ | ||
| 84 | [self viewCleanupForCollection:_yChartLabels]; | 86 | [self viewCleanupForCollection:_yChartLabels]; |
| 85 | 87 | ||
| 86 | NSArray *yAxisValues = _yLabels ? _yLabels : _yValues; | 88 | NSArray *yAxisValues = _yLabels ? _yLabels : _yValues; |
| 89 | + _yLabelSum = _yLabels ? _yLabels.count - 1 :_yLabelSum; | ||
| 87 | if (_yMaxValue) { | 90 | if (_yMaxValue) { |
| 88 | _yValueMax = _yMaxValue; | 91 | _yValueMax = _yMaxValue; |
| 89 | } else { | 92 | } else { |
| @@ -96,7 +99,7 @@ | @@ -96,7 +99,7 @@ | ||
| 96 | } | 99 | } |
| 97 | 100 | ||
| 98 | float sectionHeight = (self.frame.size.height - _chartMargin * 2 - kXLabelHeight) / _yLabelSum; | 101 | float sectionHeight = (self.frame.size.height - _chartMargin * 2 - kXLabelHeight) / _yLabelSum; |
| 99 | - for (int i = 0; i < _yLabelSum; i++) { | 102 | + for (int i = 0; i <= _yLabelSum; i++) { |
| 100 | NSString *labelText; | 103 | NSString *labelText; |
| 101 | if (_yLabels) { | 104 | if (_yLabels) { |
| 102 | float yAsixValue = [_yLabels[_yLabels.count - i - 1] floatValue]; | 105 | float yAsixValue = [_yLabels[_yLabels.count - i - 1] floatValue]; |
| @@ -117,8 +120,6 @@ | @@ -117,8 +120,6 @@ | ||
| 117 | } | 120 | } |
| 118 | } | 121 | } |
| 119 | 122 | ||
| 120 | - | ||
| 121 | - | ||
| 122 | -(void)updateChartData:(NSArray *)data{ | 123 | -(void)updateChartData:(NSArray *)data{ |
| 123 | self.yValues = data; | 124 | self.yValues = data; |
| 124 | [self updateBar]; | 125 | [self updateBar]; |
| @@ -126,10 +127,10 @@ | @@ -126,10 +127,10 @@ | ||
| 126 | 127 | ||
| 127 | - (void)getYValueMax:(NSArray *)yLabels | 128 | - (void)getYValueMax:(NSArray *)yLabels |
| 128 | { | 129 | { |
| 129 | - int max = [[yLabels valueForKeyPath:@"@max.intValue"] intValue]; | 130 | + CGFloat max = [[yLabels valueForKeyPath:@"@max.floatValue"] floatValue]; |
| 130 | 131 | ||
| 131 | //ensure max is even | 132 | //ensure max is even |
| 132 | - _yValueMax = max % 2 == 0 ? max : max + 1; | 133 | + _yValueMax = max ; |
| 133 | 134 | ||
| 134 | if (_yValueMax == 0) { | 135 | if (_yValueMax == 0) { |
| 135 | _yValueMax = _yMinValue; | 136 | _yValueMax = _yMinValue; |
| @@ -219,25 +220,27 @@ | @@ -219,25 +220,27 @@ | ||
| 219 | } | 220 | } |
| 220 | 221 | ||
| 221 | bar = [[PNBar alloc] initWithFrame:CGRectMake(barXPosition, //Bar X position | 222 | bar = [[PNBar alloc] initWithFrame:CGRectMake(barXPosition, //Bar X position |
| 222 | - self.frame.size.height - chartCavanHeight - kXLabelHeight - _chartMargin, //Bar Y position | 223 | + self.frame.size.height - chartCavanHeight - kXLabelHeight - _chartMargin , //Bar Y position |
| 223 | barWidth, // Bar witdh | 224 | barWidth, // Bar witdh |
| 224 | - chartCavanHeight)]; //Bar height | 225 | + self.showLevelLine ? chartCavanHeight/2.0:chartCavanHeight)]; //Bar height |
| 225 | - | 226 | + |
| 226 | //Change Bar Radius | 227 | //Change Bar Radius |
| 227 | bar.barRadius = _barRadius; | 228 | bar.barRadius = _barRadius; |
| 228 | 229 | ||
| 229 | //Change Bar Background color | 230 | //Change Bar Background color |
| 230 | bar.backgroundColor = _barBackgroundColor; | 231 | bar.backgroundColor = _barBackgroundColor; |
| 231 | - | ||
| 232 | //Bar StrokColor First | 232 | //Bar StrokColor First |
| 233 | if (self.strokeColor) { | 233 | if (self.strokeColor) { |
| 234 | bar.barColor = self.strokeColor; | 234 | bar.barColor = self.strokeColor; |
| 235 | }else{ | 235 | }else{ |
| 236 | bar.barColor = [self barColorAtIndex:index]; | 236 | bar.barColor = [self barColorAtIndex:index]; |
| 237 | } | 237 | } |
| 238 | + | ||
| 238 | // Add gradient | 239 | // Add gradient |
| 239 | - bar.barColorGradientStart = _barColorGradientStart; | 240 | + if (self.isGradientShow) { |
| 240 | - | 241 | + bar.barColorGradientStart = bar.barColor; |
| 242 | + } | ||
| 243 | + | ||
| 241 | //For Click Index | 244 | //For Click Index |
| 242 | bar.tag = index; | 245 | bar.tag = index; |
| 243 | 246 | ||
| @@ -247,15 +250,26 @@ | @@ -247,15 +250,26 @@ | ||
| 247 | 250 | ||
| 248 | //Height Of Bar | 251 | //Height Of Bar |
| 249 | float value = [valueString floatValue]; | 252 | float value = [valueString floatValue]; |
| 250 | - | 253 | + float grade =fabsf((float)value / (float)_yValueMax); |
| 251 | - float grade = (float)value / (float)_yValueMax; | ||
| 252 | 254 | ||
| 253 | if (isnan(grade)) { | 255 | if (isnan(grade)) { |
| 254 | grade = 0; | 256 | grade = 0; |
| 255 | } | 257 | } |
| 258 | + bar.maxDivisor = (float)_yValueMax; | ||
| 256 | bar.grade = grade; | 259 | bar.grade = grade; |
| 260 | + bar.isShowNumber = self.isShowNumbers; | ||
| 261 | + CGRect originalFrame = bar.frame; | ||
| 262 | + NSString *currentNumber = [NSString stringWithFormat:@"%f",value]; | ||
| 263 | + | ||
| 264 | + if ([[currentNumber substringToIndex:1] isEqualToString:@"-"] && self.showLevelLine) { | ||
| 265 | + CGAffineTransform transform =CGAffineTransformMakeRotation(M_PI); | ||
| 266 | + [bar setTransform:transform]; | ||
| 267 | + originalFrame.origin.y = bar.frame.origin.y + bar.frame.size.height; | ||
| 268 | + bar.frame = originalFrame; | ||
| 269 | + bar.isNegative = YES; | ||
| 257 | 270 | ||
| 258 | - index += 1; | 271 | + } |
| 272 | + index += 1; | ||
| 259 | } | 273 | } |
| 260 | } | 274 | } |
| 261 | 275 | ||
| @@ -287,11 +301,8 @@ | @@ -287,11 +301,8 @@ | ||
| 287 | [progressline setLineWidth:1.0]; | 301 | [progressline setLineWidth:1.0]; |
| 288 | [progressline setLineCapStyle:kCGLineCapSquare]; | 302 | [progressline setLineCapStyle:kCGLineCapSquare]; |
| 289 | _chartBottomLine.path = progressline.CGPath; | 303 | _chartBottomLine.path = progressline.CGPath; |
| 290 | - | ||
| 291 | - | ||
| 292 | _chartBottomLine.strokeColor = PNLightGrey.CGColor; | 304 | _chartBottomLine.strokeColor = PNLightGrey.CGColor; |
| 293 | 305 | ||
| 294 | - | ||
| 295 | CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; | 306 | CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; |
| 296 | pathAnimation.duration = 0.5; | 307 | pathAnimation.duration = 0.5; |
| 297 | pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | 308 | pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; |
| @@ -302,7 +313,7 @@ | @@ -302,7 +313,7 @@ | ||
| 302 | _chartBottomLine.strokeEnd = 1.0; | 313 | _chartBottomLine.strokeEnd = 1.0; |
| 303 | 314 | ||
| 304 | [self.layer addSublayer:_chartBottomLine]; | 315 | [self.layer addSublayer:_chartBottomLine]; |
| 305 | - | 316 | + |
| 306 | //Add left Chart Line | 317 | //Add left Chart Line |
| 307 | 318 | ||
| 308 | _chartLeftLine = [CAShapeLayer layer]; | 319 | _chartLeftLine = [CAShapeLayer layer]; |
| @@ -319,11 +330,8 @@ | @@ -319,11 +330,8 @@ | ||
| 319 | [progressLeftline setLineWidth:1.0]; | 330 | [progressLeftline setLineWidth:1.0]; |
| 320 | [progressLeftline setLineCapStyle:kCGLineCapSquare]; | 331 | [progressLeftline setLineCapStyle:kCGLineCapSquare]; |
| 321 | _chartLeftLine.path = progressLeftline.CGPath; | 332 | _chartLeftLine.path = progressLeftline.CGPath; |
| 322 | - | ||
| 323 | - | ||
| 324 | _chartLeftLine.strokeColor = PNLightGrey.CGColor; | 333 | _chartLeftLine.strokeColor = PNLightGrey.CGColor; |
| 325 | 334 | ||
| 326 | - | ||
| 327 | CABasicAnimation *pathLeftAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; | 335 | CABasicAnimation *pathLeftAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; |
| 328 | pathLeftAnimation.duration = 0.5; | 336 | pathLeftAnimation.duration = 0.5; |
| 329 | pathLeftAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | 337 | pathLeftAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; |
| @@ -335,9 +343,44 @@ | @@ -335,9 +343,44 @@ | ||
| 335 | 343 | ||
| 336 | [self.layer addSublayer:_chartLeftLine]; | 344 | [self.layer addSublayer:_chartLeftLine]; |
| 337 | } | 345 | } |
| 346 | + | ||
| 347 | + // Add Level Separator Line | ||
| 348 | + if (_showLevelLine) { | ||
| 349 | + _chartLevelLine = [CAShapeLayer layer]; | ||
| 350 | + _chartLevelLine.lineCap = kCALineCapButt; | ||
| 351 | + _chartLevelLine.fillColor = [[UIColor whiteColor] CGColor]; | ||
| 352 | + _chartLevelLine.lineWidth = 1.0; | ||
| 353 | + _chartLevelLine.strokeEnd = 0.0; | ||
| 354 | + | ||
| 355 | + UIBezierPath *progressline = [UIBezierPath bezierPath]; | ||
| 356 | + | ||
| 357 | + [progressline moveToPoint:CGPointMake(_chartMargin, (self.frame.size.height - kXLabelHeight )/2.0)]; | ||
| 358 | + [progressline addLineToPoint:CGPointMake(self.frame.size.width - _chartMargin, (self.frame.size.height - kXLabelHeight )/2.0)]; | ||
| 359 | + | ||
| 360 | + [progressline setLineWidth:1.0]; | ||
| 361 | + [progressline setLineCapStyle:kCGLineCapSquare]; | ||
| 362 | + _chartLevelLine.path = progressline.CGPath; | ||
| 363 | + | ||
| 364 | + _chartLevelLine.strokeColor = PNLightGrey.CGColor; | ||
| 365 | + | ||
| 366 | + CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; | ||
| 367 | + pathAnimation.duration = 0.5; | ||
| 368 | + pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | ||
| 369 | + pathAnimation.fromValue = @0.0f; | ||
| 370 | + pathAnimation.toValue = @1.0f; | ||
| 371 | + [_chartLevelLine addAnimation:pathAnimation forKey:@"strokeEndAnimation"]; | ||
| 372 | + | ||
| 373 | + _chartLevelLine.strokeEnd = 1.0; | ||
| 374 | + | ||
| 375 | + [self.layer addSublayer:_chartLevelLine]; | ||
| 376 | + } else { | ||
| 377 | + if (_chartLevelLine) { | ||
| 378 | + [_chartLevelLine removeFromSuperlayer]; | ||
| 379 | + _chartLevelLine = nil; | ||
| 380 | + } | ||
| 381 | + } | ||
| 338 | } | 382 | } |
| 339 | 383 | ||
| 340 | - | ||
| 341 | - (void)viewCleanupForCollection:(NSMutableArray *)array | 384 | - (void)viewCleanupForCollection:(NSMutableArray *)array |
| 342 | { | 385 | { |
| 343 | if (array.count) { | 386 | if (array.count) { |
| @@ -359,7 +402,6 @@ | @@ -359,7 +402,6 @@ | ||
| 359 | } | 402 | } |
| 360 | } | 403 | } |
| 361 | 404 | ||
| 362 | - | ||
| 363 | #pragma mark - Touch detection | 405 | #pragma mark - Touch detection |
| 364 | 406 | ||
| 365 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event | 407 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event |
| @@ -368,7 +410,6 @@ | @@ -368,7 +410,6 @@ | ||
| 368 | [super touchesBegan:touches withEvent:event]; | 410 | [super touchesBegan:touches withEvent:event]; |
| 369 | } | 411 | } |
| 370 | 412 | ||
| 371 | - | ||
| 372 | - (void)touchPoint:(NSSet *)touches withEvent:(UIEvent *)event | 413 | - (void)touchPoint:(NSSet *)touches withEvent:(UIEvent *)event |
| 373 | { | 414 | { |
| 374 | //Get the point user touched | 415 | //Get the point user touched |
| @@ -1012,7 +1012,6 @@ | @@ -1012,7 +1012,6 @@ | ||
| 1012 | 1012 | ||
| 1013 | -(void)setGradeFrame:(CATextLayer*)textLayer grade:(CGFloat)grade pointCenter:(CGPoint)pointCenter width:(CGFloat)width | 1013 | -(void)setGradeFrame:(CATextLayer*)textLayer grade:(CGFloat)grade pointCenter:(CGPoint)pointCenter width:(CGFloat)width |
| 1014 | { | 1014 | { |
| 1015 | - return; | ||
| 1016 | CGFloat textheigt = width*3; | 1015 | CGFloat textheigt = width*3; |
| 1017 | CGFloat textWidth = width*4; | 1016 | CGFloat textWidth = width*4; |
| 1018 | CGFloat textStartPosY; | 1017 | CGFloat textStartPosY; |
| @@ -21,11 +21,10 @@ | @@ -21,11 +21,10 @@ | ||
| 21 | 0AF7A880182AA9F6003645C4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0AF7A87F182AA9F6003645C4 /* Images.xcassets */; }; | 21 | 0AF7A880182AA9F6003645C4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0AF7A87F182AA9F6003645C4 /* Images.xcassets */; }; |
| 22 | 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */; }; | 22 | 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */; }; |
| 23 | 5C728F7B8AACCC0864A63B26 /* libPods-PNChartTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B0A0D7DDAB496680487BF1E5 /* libPods-PNChartTests.a */; }; | 23 | 5C728F7B8AACCC0864A63B26 /* libPods-PNChartTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B0A0D7DDAB496680487BF1E5 /* libPods-PNChartTests.a */; }; |
| 24 | + 5C9B4AA31B05BBCB00093EBE /* PNBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C9B4AA21B05BBCB00093EBE /* PNBarChart.m */; }; | ||
| 24 | 6E984E5D1AE2B00600E817A0 /* PNBarChartTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E984E5C1AE2B00600E817A0 /* PNBarChartTests.m */; }; | 25 | 6E984E5D1AE2B00600E817A0 /* PNBarChartTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E984E5C1AE2B00600E817A0 /* PNBarChartTests.m */; }; |
| 25 | 6E984E5E1AE2B03800E817A0 /* PNBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177EC9198DFAC400017E27 /* PNBar.m */; }; | 26 | 6E984E5E1AE2B03800E817A0 /* PNBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177EC9198DFAC400017E27 /* PNBar.m */; }; |
| 26 | - 6E984E5F1AE2B03E00E817A0 /* PNBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECB198DFAC400017E27 /* PNBarChart.m */; }; | ||
| 27 | 91177ED8198DFAC400017E27 /* PNBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177EC9198DFAC400017E27 /* PNBar.m */; }; | 27 | 91177ED8198DFAC400017E27 /* PNBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177EC9198DFAC400017E27 /* PNBar.m */; }; |
| 28 | - 91177EDA198DFAC400017E27 /* PNBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECB198DFAC400017E27 /* PNBarChart.m */; }; | ||
| 29 | 91177EDC198DFAC400017E27 /* PNCircleChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECD198DFAC400017E27 /* PNCircleChart.m */; }; | 28 | 91177EDC198DFAC400017E27 /* PNCircleChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECD198DFAC400017E27 /* PNCircleChart.m */; }; |
| 30 | 91177EDE198DFAC400017E27 /* PNLineChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECF198DFAC400017E27 /* PNLineChart.m */; }; | 29 | 91177EDE198DFAC400017E27 /* PNLineChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECF198DFAC400017E27 /* PNLineChart.m */; }; |
| 31 | 91177EE0198DFAC400017E27 /* PNLineChartData.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ED1198DFAC400017E27 /* PNLineChartData.m */; }; | 30 | 91177EE0198DFAC400017E27 /* PNLineChartData.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ED1198DFAC400017E27 /* PNLineChartData.m */; }; |
| @@ -75,13 +74,13 @@ | @@ -75,13 +74,13 @@ | ||
| 75 | 2980CA20C29DC029B2D0B926 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; }; | 74 | 2980CA20C29DC029B2D0B926 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; }; |
| 76 | 3BA6321352024B1FBA0158B0 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; | 75 | 3BA6321352024B1FBA0158B0 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 77 | 4D54B84CA1CAEB2BBBC9DCFA /* Pods-PNChartTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PNChartTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PNChartTests/Pods-PNChartTests.release.xcconfig"; sourceTree = "<group>"; }; | 76 | 4D54B84CA1CAEB2BBBC9DCFA /* Pods-PNChartTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PNChartTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PNChartTests/Pods-PNChartTests.release.xcconfig"; sourceTree = "<group>"; }; |
| 77 | + 5C9B4AA21B05BBCB00093EBE /* PNBarChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBarChart.m; sourceTree = "<group>"; }; | ||
| 78 | 6E984E511AE2AF2D00E817A0 /* PNChartTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PNChartTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; | 78 | 6E984E511AE2AF2D00E817A0 /* PNChartTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PNChartTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 79 | 6E984E541AE2AF2D00E817A0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | 79 | 6E984E541AE2AF2D00E817A0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; |
| 80 | 6E984E5C1AE2B00600E817A0 /* PNBarChartTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBarChartTests.m; sourceTree = "<group>"; }; | 80 | 6E984E5C1AE2B00600E817A0 /* PNBarChartTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBarChartTests.m; sourceTree = "<group>"; }; |
| 81 | 91177EC8198DFAC400017E27 /* PNBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNBar.h; sourceTree = "<group>"; }; | 81 | 91177EC8198DFAC400017E27 /* PNBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNBar.h; sourceTree = "<group>"; }; |
| 82 | 91177EC9198DFAC400017E27 /* PNBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBar.m; sourceTree = "<group>"; }; | 82 | 91177EC9198DFAC400017E27 /* PNBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBar.m; sourceTree = "<group>"; }; |
| 83 | 91177ECA198DFAC400017E27 /* PNBarChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNBarChart.h; sourceTree = "<group>"; }; | 83 | 91177ECA198DFAC400017E27 /* PNBarChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNBarChart.h; sourceTree = "<group>"; }; |
| 84 | - 91177ECB198DFAC400017E27 /* PNBarChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBarChart.m; sourceTree = "<group>"; }; | ||
| 85 | 91177ECC198DFAC400017E27 /* PNCircleChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNCircleChart.h; sourceTree = "<group>"; }; | 84 | 91177ECC198DFAC400017E27 /* PNCircleChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNCircleChart.h; sourceTree = "<group>"; }; |
| 86 | 91177ECD198DFAC400017E27 /* PNCircleChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNCircleChart.m; sourceTree = "<group>"; }; | 85 | 91177ECD198DFAC400017E27 /* PNCircleChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNCircleChart.m; sourceTree = "<group>"; }; |
| 87 | 91177ECE198DFAC400017E27 /* PNLineChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNLineChart.h; sourceTree = "<group>"; }; | 86 | 91177ECE198DFAC400017E27 /* PNLineChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNLineChart.h; sourceTree = "<group>"; }; |
| @@ -249,7 +248,7 @@ | @@ -249,7 +248,7 @@ | ||
| 249 | 91177EC8198DFAC400017E27 /* PNBar.h */, | 248 | 91177EC8198DFAC400017E27 /* PNBar.h */, |
| 250 | 91177EC9198DFAC400017E27 /* PNBar.m */, | 249 | 91177EC9198DFAC400017E27 /* PNBar.m */, |
| 251 | 91177ECA198DFAC400017E27 /* PNBarChart.h */, | 250 | 91177ECA198DFAC400017E27 /* PNBarChart.h */, |
| 252 | - 91177ECB198DFAC400017E27 /* PNBarChart.m */, | 251 | + 5C9B4AA21B05BBCB00093EBE /* PNBarChart.m */, |
| 253 | 91177ECC198DFAC400017E27 /* PNCircleChart.h */, | 252 | 91177ECC198DFAC400017E27 /* PNCircleChart.h */, |
| 254 | 91177ECD198DFAC400017E27 /* PNCircleChart.m */, | 253 | 91177ECD198DFAC400017E27 /* PNCircleChart.m */, |
| 255 | 91177ECE198DFAC400017E27 /* PNLineChart.h */, | 254 | 91177ECE198DFAC400017E27 /* PNLineChart.h */, |
| @@ -442,7 +441,6 @@ | @@ -442,7 +441,6 @@ | ||
| 442 | 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */, | 441 | 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */, |
| 443 | 0A29228A1A423FB300A42BC4 /* PNScatterChartDataItem.m in Sources */, | 442 | 0A29228A1A423FB300A42BC4 /* PNScatterChartDataItem.m in Sources */, |
| 444 | A9C75FA61A9F1DA900A54638 /* PNGenericChart.m in Sources */, | 443 | A9C75FA61A9F1DA900A54638 /* PNGenericChart.m in Sources */, |
| 445 | - 91177EDA198DFAC400017E27 /* PNBarChart.m in Sources */, | ||
| 446 | 91177EE6198DFAC400017E27 /* PNPieChartDataItem.m in Sources */, | 444 | 91177EE6198DFAC400017E27 /* PNPieChartDataItem.m in Sources */, |
| 447 | 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */, | 445 | 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */, |
| 448 | 91177EE0198DFAC400017E27 /* PNLineChartData.m in Sources */, | 446 | 91177EE0198DFAC400017E27 /* PNLineChartData.m in Sources */, |
| @@ -450,6 +448,7 @@ | @@ -450,6 +448,7 @@ | ||
| 450 | 0AF7A874182AA9F6003645C4 /* main.m in Sources */, | 448 | 0AF7A874182AA9F6003645C4 /* main.m in Sources */, |
| 451 | 91177EE4198DFAC400017E27 /* PNPieChart.m in Sources */, | 449 | 91177EE4198DFAC400017E27 /* PNPieChart.m in Sources */, |
| 452 | 0AF7A878182AA9F6003645C4 /* PCAppDelegate.m in Sources */, | 450 | 0AF7A878182AA9F6003645C4 /* PCAppDelegate.m in Sources */, |
| 451 | + 5C9B4AA31B05BBCB00093EBE /* PNBarChart.m in Sources */, | ||
| 453 | 0A2922891A423FB300A42BC4 /* PNScatterChartData.m in Sources */, | 452 | 0A2922891A423FB300A42BC4 /* PNScatterChartData.m in Sources */, |
| 454 | ); | 453 | ); |
| 455 | runOnlyForDeploymentPostprocessing = 0; | 454 | runOnlyForDeploymentPostprocessing = 0; |
| @@ -458,7 +457,6 @@ | @@ -458,7 +457,6 @@ | ||
| 458 | isa = PBXSourcesBuildPhase; | 457 | isa = PBXSourcesBuildPhase; |
| 459 | buildActionMask = 2147483647; | 458 | buildActionMask = 2147483647; |
| 460 | files = ( | 459 | files = ( |
| 461 | - 6E984E5F1AE2B03E00E817A0 /* PNBarChart.m in Sources */, | ||
| 462 | 6E984E5E1AE2B03800E817A0 /* PNBar.m in Sources */, | 460 | 6E984E5E1AE2B03800E817A0 /* PNBar.m in Sources */, |
| 463 | 6E984E5D1AE2B00600E817A0 /* PNBarChartTests.m in Sources */, | 461 | 6E984E5D1AE2B00600E817A0 /* PNBarChartTests.m in Sources */, |
| 464 | ); | 462 | ); |
| @@ -97,22 +97,17 @@ | @@ -97,22 +97,17 @@ | ||
| 97 | self.barChart.backgroundColor = [UIColor clearColor]; | 97 | self.barChart.backgroundColor = [UIColor clearColor]; |
| 98 | self.barChart.yLabelFormatter = ^(CGFloat yValue){ | 98 | self.barChart.yLabelFormatter = ^(CGFloat yValue){ |
| 99 | CGFloat yValueParsed = yValue; | 99 | CGFloat yValueParsed = yValue; |
| 100 | - NSString * labelText = [NSString stringWithFormat:@"%1.f",yValueParsed]; | 100 | + NSString * labelText = [NSString stringWithFormat:@"%0.f",yValueParsed]; |
| 101 | return labelText; | 101 | return labelText; |
| 102 | }; | 102 | }; |
| 103 | self.barChart.labelMarginTop = 5.0; | 103 | self.barChart.labelMarginTop = 5.0; |
| 104 | - [self.barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; | 104 | + self.barChart.showChartBorder = YES; |
| 105 | - self.barChart.rotateForXAxisText = true ; | 105 | + [self.barChart setXLabels:@[@"2",@"3",@"4",@"5"]]; |
| 106 | - | 106 | +// self.barChart.yLabels = @[@-10,@0,@10]; |
| 107 | - self.barChart.yLabelSum=5; | 107 | + [self.barChart setYValues:@[@10.82,@1.88,@6.96,@33.93]]; |
| 108 | - self.barChart.yMaxValue=100; | 108 | + [self.barChart setStrokeColors:@[PNGreen,PNGreen,PNRed,PNGreen]]; |
| 109 | - | 109 | +// self.barChart.isGradientShow = NO; |
| 110 | - [self.barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]]; | 110 | + self.barChart.isShowNumbers = YES; |
| 111 | -// self.barChart.yLabels = @[@0,@20,@40,@60]; | ||
| 112 | - [self.barChart setStrokeColors:@[PNGreen,PNGreen,PNRed,PNGreen,PNGreen,PNYellow,PNGreen]]; | ||
| 113 | - // Adding gradient | ||
| 114 | - self.barChart.barColorGradientStart = [UIColor blueColor]; | ||
| 115 | - | ||
| 116 | [self.barChart strokeChart]; | 111 | [self.barChart strokeChart]; |
| 117 | 112 | ||
| 118 | self.barChart.delegate = self; | 113 | self.barChart.delegate = self; |
| @@ -10,4 +10,5 @@ SPEC CHECKSUMS: | @@ -10,4 +10,5 @@ SPEC CHECKSUMS: | ||
| 10 | Expecta: 78b4e8b0c8291fa4524d7f74016b6065c2e391ec | 10 | Expecta: 78b4e8b0c8291fa4524d7f74016b6065c2e391ec |
| 11 | UICountingLabel: 1db4e7d023e1762171eb226d6dff47a7a84f27aa | 11 | UICountingLabel: 1db4e7d023e1762171eb226d6dff47a7a84f27aa |
| 12 | 12 | ||
| 13 | -COCOAPODS: 0.36.3 | 13 | +COCOAPODS: 0.37.1 |
| 14 | + |
-
Please register or login to post a comment