Showing
7 changed files
with
85 additions
and
15 deletions
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 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; |
| @@ -23,5 +24,6 @@ | @@ -23,5 +24,6 @@ | ||
| 23 | @property (nonatomic) CAShapeLayer *gradeLayer; | 24 | @property (nonatomic) CAShapeLayer *gradeLayer; |
| 24 | @property (nonatomic) CATextLayer* textLayer; | 25 | @property (nonatomic) CATextLayer* textLayer; |
| 25 | 26 | ||
| 27 | +@property (nonatomic, assign) BOOL isNegative; //!< 是否是负数 | ||
| 26 | 28 | ||
| 27 | @end | 29 | @end |
| @@ -208,6 +208,23 @@ | @@ -208,6 +208,23 @@ | ||
| 208 | 208 | ||
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | +- (void)setIsNegative:(BOOL)isNegative{ | ||
| 212 | + if (isNegative) { | ||
| 213 | + [self.textLayer setString:[[NSString alloc]initWithFormat:@"-%0.f",_grade*100]]; | ||
| 214 | + CABasicAnimation* rotationAnimation; | ||
| 215 | + rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; | ||
| 216 | + rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI]; | ||
| 217 | + [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | ||
| 218 | + rotationAnimation.duration = 0.1; | ||
| 219 | + rotationAnimation.repeatCount = 0;//你可以设置到最大的整数值 | ||
| 220 | + rotationAnimation.cumulative = NO; | ||
| 221 | + rotationAnimation.removedOnCompletion = NO; | ||
| 222 | + rotationAnimation.fillMode = kCAFillModeForwards; | ||
| 223 | + [self.textLayer addAnimation:rotationAnimation forKey:@"Rotation"]; | ||
| 224 | + | ||
| 225 | + } | ||
| 226 | +} | ||
| 227 | + | ||
| 211 | -(CABasicAnimation*)fadeAnimation | 228 | -(CABasicAnimation*)fadeAnimation |
| 212 | { | 229 | { |
| 213 | CABasicAnimation* fadeAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; | 230 | CABasicAnimation* fadeAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; |
| @@ -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,5 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue); | @@ -97,4 +103,5 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue); | ||
| 97 | 103 | ||
| 98 | @property (nonatomic, weak) id<PNChartDelegate> delegate; | 104 | @property (nonatomic, weak) id<PNChartDelegate> delegate; |
| 99 | 105 | ||
| 106 | + | ||
| 100 | @end | 107 | @end |
| @@ -56,9 +56,10 @@ | @@ -56,9 +56,10 @@ | ||
| 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 | } |
| @@ -80,6 +81,7 @@ | @@ -80,6 +81,7 @@ | ||
| 80 | [self viewCleanupForCollection:_yChartLabels]; | 81 | [self viewCleanupForCollection:_yChartLabels]; |
| 81 | 82 | ||
| 82 | NSArray *yAxisValues = _yLabels ? _yLabels : _yValues; | 83 | NSArray *yAxisValues = _yLabels ? _yLabels : _yValues; |
| 84 | + _yLabelSum = _yLabels ? _yLabels.count - 1 :_yLabelSum; | ||
| 83 | if (_yMaxValue) { | 85 | if (_yMaxValue) { |
| 84 | _yValueMax = _yMaxValue; | 86 | _yValueMax = _yMaxValue; |
| 85 | } else { | 87 | } else { |
| @@ -92,7 +94,7 @@ | @@ -92,7 +94,7 @@ | ||
| 92 | } | 94 | } |
| 93 | 95 | ||
| 94 | float sectionHeight = (self.frame.size.height - _chartMargin * 2 - kXLabelHeight) / _yLabelSum; | 96 | float sectionHeight = (self.frame.size.height - _chartMargin * 2 - kXLabelHeight) / _yLabelSum; |
| 95 | - for (int i = 0; i < _yLabelSum; i++) { | 97 | + for (int i = 0; i <= _yLabelSum; i++) { |
| 96 | NSString *labelText; | 98 | NSString *labelText; |
| 97 | if (_yLabels) { | 99 | if (_yLabels) { |
| 98 | float yAsixValue = [_yLabels[_yLabels.count - i - 1] floatValue]; | 100 | float yAsixValue = [_yLabels[_yLabels.count - i - 1] floatValue]; |
| @@ -214,9 +216,9 @@ | @@ -214,9 +216,9 @@ | ||
| 214 | } | 216 | } |
| 215 | 217 | ||
| 216 | bar = [[PNBar alloc] initWithFrame:CGRectMake(barXPosition, //Bar X position | 218 | bar = [[PNBar alloc] initWithFrame:CGRectMake(barXPosition, //Bar X position |
| 217 | - self.frame.size.height - chartCavanHeight - kXLabelHeight - _chartMargin, //Bar Y position | 219 | + self.frame.size.height - chartCavanHeight - kXLabelHeight - _chartMargin , //Bar Y position |
| 218 | barWidth, // Bar witdh | 220 | barWidth, // Bar witdh |
| 219 | - chartCavanHeight)]; //Bar height | 221 | + self.showLevelLine ? chartCavanHeight/2.0:chartCavanHeight)]; //Bar height |
| 220 | 222 | ||
| 221 | //Change Bar Radius | 223 | //Change Bar Radius |
| 222 | bar.barRadius = _barRadius; | 224 | bar.barRadius = _barRadius; |
| @@ -243,12 +245,21 @@ | @@ -243,12 +245,21 @@ | ||
| 243 | //Height Of Bar | 245 | //Height Of Bar |
| 244 | float value = [valueString floatValue]; | 246 | float value = [valueString floatValue]; |
| 245 | 247 | ||
| 246 | - float grade = (float)value / (float)_yValueMax; | 248 | + float grade =ABS((float)value / (float)_yValueMax); |
| 247 | 249 | ||
| 248 | if (isnan(grade)) { | 250 | if (isnan(grade)) { |
| 249 | grade = 0; | 251 | grade = 0; |
| 250 | } | 252 | } |
| 251 | bar.grade = grade; | 253 | bar.grade = grade; |
| 254 | + CGRect originalFrame = bar.frame; | ||
| 255 | + if (value<0) { | ||
| 256 | + CGAffineTransform transform =CGAffineTransformMakeRotation(M_PI); | ||
| 257 | + [bar setTransform:transform]; | ||
| 258 | + | ||
| 259 | + originalFrame.origin.y = bar.frame.origin.y + bar.frame.size.height; | ||
| 260 | + bar.frame = originalFrame; | ||
| 261 | + bar.isNegative = YES; | ||
| 262 | + } | ||
| 252 | 263 | ||
| 253 | index += 1; | 264 | index += 1; |
| 254 | } | 265 | } |
| @@ -330,6 +341,39 @@ | @@ -330,6 +341,39 @@ | ||
| 330 | 341 | ||
| 331 | [self.layer addSublayer:_chartLeftLine]; | 342 | [self.layer addSublayer:_chartLeftLine]; |
| 332 | } | 343 | } |
| 344 | + | ||
| 345 | + // Add Level Separator Line | ||
| 346 | + if (_showLevelLine) { | ||
| 347 | + _chartLevelLine = [CAShapeLayer layer]; | ||
| 348 | + _chartLevelLine.lineCap = kCALineCapButt; | ||
| 349 | + _chartLevelLine.fillColor = [[UIColor whiteColor] CGColor]; | ||
| 350 | + _chartLevelLine.lineWidth = 1.0; | ||
| 351 | + _chartLevelLine.strokeEnd = 0.0; | ||
| 352 | + | ||
| 353 | + UIBezierPath *progressline = [UIBezierPath bezierPath]; | ||
| 354 | + | ||
| 355 | + [progressline moveToPoint:CGPointMake(_chartMargin, (self.frame.size.height - kXLabelHeight )/2.0)]; | ||
| 356 | + [progressline addLineToPoint:CGPointMake(self.frame.size.width - _chartMargin, (self.frame.size.height - kXLabelHeight )/2.0)]; | ||
| 357 | + | ||
| 358 | + [progressline setLineWidth:1.0]; | ||
| 359 | + [progressline setLineCapStyle:kCGLineCapSquare]; | ||
| 360 | + _chartLevelLine.path = progressline.CGPath; | ||
| 361 | + | ||
| 362 | + | ||
| 363 | + _chartLevelLine.strokeColor = PNLightGrey.CGColor; | ||
| 364 | + | ||
| 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 | + } | ||
| 333 | } | 377 | } |
| 334 | 378 | ||
| 335 | 379 |
| @@ -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 | ); |
| @@ -101,14 +101,16 @@ | @@ -101,14 +101,16 @@ | ||
| 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.showLevelLine = YES; |
| 105 | + self.barChart.showChartBorder = YES; | ||
| 106 | + [self.barChart setXLabels:@[@"2",@"3",@"4",@"5"]]; | ||
| 105 | self.barChart.rotateForXAxisText = true ; | 107 | self.barChart.rotateForXAxisText = true ; |
| 106 | 108 | ||
| 107 | self.barChart.yLabelSum=5; | 109 | self.barChart.yLabelSum=5; |
| 108 | self.barChart.yMaxValue=100; | 110 | self.barChart.yMaxValue=100; |
| 111 | + self.barChart.yLabels = @[@-10,@0,@10]; | ||
| 112 | + [self.barChart setYValues:@[@1,@24,@(0-12),@18]]; | ||
| 109 | 113 | ||
| 110 | - [self.barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]]; | ||
| 111 | -// self.barChart.yLabels = @[@0,@20,@40,@60]; | ||
| 112 | [self.barChart setStrokeColors:@[PNGreen,PNGreen,PNRed,PNGreen,PNGreen,PNYellow,PNGreen]]; | 114 | [self.barChart setStrokeColors:@[PNGreen,PNGreen,PNRed,PNGreen,PNGreen,PNYellow,PNGreen]]; |
| 113 | // Adding gradient | 115 | // Adding gradient |
| 114 | self.barChart.barColorGradientStart = [UIColor blueColor]; | 116 | self.barChart.barColorGradientStart = [UIColor blueColor]; |
| @@ -10,4 +10,4 @@ SPEC CHECKSUMS: | @@ -10,4 +10,4 @@ SPEC CHECKSUMS: | ||
| 10 | Expecta: 8c507baf13211207b1e9d0a741480600e6b4ed15 | 10 | Expecta: 8c507baf13211207b1e9d0a741480600e6b4ed15 |
| 11 | UICountingLabel: 1db4e7d023e1762171eb226d6dff47a7a84f27aa | 11 | UICountingLabel: 1db4e7d023e1762171eb226d6dff47a7a84f27aa |
| 12 | 12 | ||
| 13 | -COCOAPODS: 0.36.4 | 13 | +COCOAPODS: 0.37.1 |
-
Please register or login to post a comment