Kevin

Merge pull request #83 from moflo/master

Add gradient option to bar & circle charts
@@ -11,12 +11,12 @@ Pod::Spec.new do |s| @@ -11,12 +11,12 @@ Pod::Spec.new do |s|
11 s.author = { "Kevin" => "kevinchou.c@gmail.com" } 11 s.author = { "Kevin" => "kevinchou.c@gmail.com" }
12 12
13 s.platform = :ios, '6.0' 13 s.platform = :ios, '6.0'
14 - s.source = { :git => "https://github.com/kevinzhow/PNChart.git" } 14 + s.source = { :git => "https://github.com/moflo/PNChart.git" }
15 15
16 s.ios.dependency 'UICountingLabel', '~> 1.0.0' 16 s.ios.dependency 'UICountingLabel', '~> 1.0.0'
17 17
18 - s.source_files = 'PNChart/*.{h,m}' 18 + s.source_files = 'PNChart/**/*.{h,m}'
19 - s.public_header_files = 'PNChart/*.h' 19 + s.public_header_files = 'PNChart/**/*.h'
20 s.frameworks = 'CoreGraphics', 'UIKit', 'Foundation', 'QuartzCore' 20 s.frameworks = 'CoreGraphics', 'UIKit', 'Foundation', 'QuartzCore'
21 s.requires_arc = true 21 s.requires_arc = true
22 end 22 end
@@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
16 @property (nonatomic) float grade; 16 @property (nonatomic) float grade;
17 @property (nonatomic) CAShapeLayer *chartLine; 17 @property (nonatomic) CAShapeLayer *chartLine;
18 @property (nonatomic) UIColor *barColor; 18 @property (nonatomic) UIColor *barColor;
  19 +@property (nonatomic) UIColor *barColorGradientStart;
19 @property (nonatomic) CGFloat barRadius; 20 @property (nonatomic) CGFloat barRadius;
20 21
21 @end 22 @end
@@ -64,6 +64,39 @@ @@ -64,6 +64,39 @@
64 [_chartLine addAnimation:pathAnimation forKey:@"strokeEndAnimation"]; 64 [_chartLine addAnimation:pathAnimation forKey:@"strokeEndAnimation"];
65 65
66 _chartLine.strokeEnd = 1.0; 66 _chartLine.strokeEnd = 1.0;
  67 +
  68 + // Check if user wants to add a gradient from the start color to the bar color
  69 + if (_barColorGradientStart) {
  70 +
  71 + // Add gradient
  72 + CAShapeLayer *gradientMask = [CAShapeLayer layer];
  73 + gradientMask.fillColor = [[UIColor clearColor] CGColor];
  74 + gradientMask.strokeColor = [[UIColor blackColor] CGColor];
  75 + //gradientMask.lineWidth = 4;
  76 + gradientMask.lineWidth = self.frame.size.width;
  77 + gradientMask.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
  78 + gradientMask.path = progressline.CGPath;
  79 +
  80 +
  81 + CAGradientLayer *gradientLayer = [CAGradientLayer layer];
  82 + gradientLayer.startPoint = CGPointMake(0.5,1.0);
  83 + gradientLayer.endPoint = CGPointMake(0.5,0.0);
  84 + gradientLayer.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
  85 + UIColor *endColor = (_barColor ? _barColor : [UIColor greenColor]);
  86 + NSArray *colors = @[
  87 + (id)_barColorGradientStart.CGColor,
  88 + (id)endColor.CGColor
  89 + ];
  90 + gradientLayer.colors = colors;
  91 +
  92 + [gradientLayer setMask:gradientMask];
  93 +
  94 + [_chartLine addSublayer:gradientLayer];
  95 +
  96 + gradientMask.strokeEnd = 1.0;
  97 + [gradientMask addAnimation:pathAnimation forKey:@"strokeEndAnimation"];
  98 + }
  99 +
67 } 100 }
68 101
69 102
@@ -74,6 +107,17 @@ @@ -74,6 +107,17 @@
74 } completion:nil]; 107 } completion:nil];
75 } 108 }
76 109
  110 +- (void)setBarColorGradientStart:(UIColor *)barColorGradientStart
  111 +{
  112 + // Set gradient color, remove any existing sublayer first
  113 + for (CALayer *sublayer in [_chartLine sublayers]) {
  114 + [sublayer removeFromSuperlayer];
  115 + }
  116 + _barColorGradientStart = barColorGradientStart;
  117 +
  118 + [self setGrade:_grade];
  119 +
  120 +}
77 121
78 // Only override drawRect: if you perform custom drawing. 122 // Only override drawRect: if you perform custom drawing.
79 // An empty implementation adversely affects performance during animation. 123 // An empty implementation adversely affects performance during animation.
@@ -123,6 +123,12 @@ typedef NSString *(^PNyLabelFromatter)(CGFloat yLabelValue); @@ -123,6 +123,12 @@ typedef NSString *(^PNyLabelFromatter)(CGFloat yLabelValue);
123 */ 123 */
124 @property (nonatomic) CGFloat yMinValue; 124 @property (nonatomic) CGFloat yMinValue;
125 125
  126 +/*
  127 + switch to indicate that the bar should be filled as a gradient
  128 + */
  129 +@property (nonatomic) UIColor *barColorGradientStart;
  130 +
  131 +
126 @property (nonatomic, retain) id<PNChartDelegate> delegate; 132 @property (nonatomic, retain) id<PNChartDelegate> delegate;
127 133
128 @end 134 @end
@@ -205,9 +205,14 @@ @@ -205,9 +205,14 @@
205 //Height Of Bar 205 //Height Of Bar
206 bar.grade = grade; 206 bar.grade = grade;
207 207
  208 + // Add gradient
  209 + bar.barColorGradientStart = _barColorGradientStart;
  210 +
  211 +
208 //For Click Index 212 //For Click Index
209 bar.tag = index; 213 bar.tag = index;
210 214
  215 +
211 [_bars addObject:bar]; 216 [_bars addObject:bar];
212 [self addSubview:bar]; 217 [self addSubview:bar];
213 218
@@ -26,6 +26,7 @@ typedef NS_ENUM(NSUInteger, PNChartFormatType) { @@ -26,6 +26,7 @@ typedef NS_ENUM(NSUInteger, PNChartFormatType) {
26 26
27 @property (strong, nonatomic) UICountingLabel *countingLabel; 27 @property (strong, nonatomic) UICountingLabel *countingLabel;
28 @property (nonatomic) UIColor *strokeColor; 28 @property (nonatomic) UIColor *strokeColor;
  29 +@property (nonatomic) UIColor *strokeColorGradientStart;
29 @property (nonatomic) NSNumber *total; 30 @property (nonatomic) NSNumber *total;
30 @property (nonatomic) NSNumber *current; 31 @property (nonatomic) NSNumber *current;
31 @property (nonatomic) NSNumber *lineWidth; 32 @property (nonatomic) NSNumber *lineWidth;
@@ -101,6 +101,41 @@ @@ -101,6 +101,41 @@
101 _circle.strokeEnd = [_current floatValue] / [_total floatValue]; 101 _circle.strokeEnd = [_current floatValue] / [_total floatValue];
102 102
103 [_countingLabel countFrom:0 to:[_current floatValue] withDuration:1.0]; 103 [_countingLabel countFrom:0 to:[_current floatValue] withDuration:1.0];
  104 +
  105 +
  106 + // Check if user wants to add a gradient from the start color to the bar color
  107 + if (_strokeColorGradientStart) {
  108 +
  109 + // Add gradient
  110 + CAShapeLayer *gradientMask = [CAShapeLayer layer];
  111 + gradientMask.fillColor = [[UIColor clearColor] CGColor];
  112 + gradientMask.strokeColor = [[UIColor blackColor] CGColor];
  113 + gradientMask.lineWidth = _circle.lineWidth;
  114 + gradientMask.lineCap = kCALineCapRound;
  115 + CGRect gradientFrame = CGRectMake(0, 0, 2*self.bounds.size.width, 2*self.bounds.size.height);
  116 + gradientMask.frame = gradientFrame;
  117 + gradientMask.path = _circle.path;
  118 +
  119 + CAGradientLayer *gradientLayer = [CAGradientLayer layer];
  120 + gradientLayer.startPoint = CGPointMake(0.5,1.0);
  121 + gradientLayer.endPoint = CGPointMake(0.5,0.0);
  122 + gradientLayer.frame = gradientFrame;
  123 + UIColor *endColor = (_strokeColor ? _strokeColor : [UIColor greenColor]);
  124 + NSArray *colors = @[
  125 + (id)endColor.CGColor,
  126 + (id)_strokeColorGradientStart.CGColor
  127 + ];
  128 + gradientLayer.colors = colors;
  129 +
  130 + [gradientLayer setMask:gradientMask];
  131 +
  132 + [_circle addSublayer:gradientLayer];
  133 +
  134 + gradientMask.strokeEnd = [_current floatValue] / [_total floatValue];
  135 +
  136 + [gradientMask addAnimation:pathAnimation forKey:@"strokeEndAnimation"];
  137 + }
  138 +
104 } 139 }
105 140
106 141
@@ -67,18 +67,20 @@ @@ -67,18 +67,20 @@
67 CGFloat yStep = (_yValueMax - _yValueMin) / _yLabelNum; 67 CGFloat yStep = (_yValueMax - _yValueMin) / _yLabelNum;
68 CGFloat yStepHeight = _chartCavanHeight / _yLabelNum; 68 CGFloat yStepHeight = _chartCavanHeight / _yLabelNum;
69 69
  70 + if (_showLabel) {
  71 +
  72 + NSInteger index = 0;
  73 + NSInteger num = _yLabelNum + 1;
70 74
71 - NSInteger index = 0; 75 + while (num > 0) {
72 - NSInteger num = _yLabelNum + 1; 76 + PNChartLabel *label = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (_chartCavanHeight - index * yStepHeight), _chartMargin, _yLabelHeight)];
73 - 77 + [label setTextAlignment:NSTextAlignmentRight];
74 - while (num > 0) { 78 + NSString *yLabelFormat = self.yLabelFormat ? self.yLabelFormat : @"%1.f";
75 - PNChartLabel *label = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (_chartCavanHeight - index * yStepHeight), _chartMargin, _yLabelHeight)]; 79 + label.text = [NSString stringWithFormat:yLabelFormat, _yValueMin + (yStep * index)];
76 - [label setTextAlignment:NSTextAlignmentRight]; 80 + [self addSubview:label];
77 - NSString *yLabelFormat = self.yLabelFormat ? self.yLabelFormat : @"%1.f"; 81 + index += 1;
78 - label.text = [NSString stringWithFormat:yLabelFormat, _yValueMin + (yStep * index)]; 82 + num -= 1;
79 - [self addSubview:label]; 83 + }
80 - index += 1;  
81 - num -= 1;  
82 } 84 }
83 } 85 }
84 86
@@ -22,18 +22,26 @@ @@ -22,18 +22,26 @@
22 0AF7A891182AA9F6003645C4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0AF7A88F182AA9F6003645C4 /* InfoPlist.strings */; }; 22 0AF7A891182AA9F6003645C4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0AF7A88F182AA9F6003645C4 /* InfoPlist.strings */; };
23 0AF7A893182AA9F6003645C4 /* PNChartDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A892182AA9F6003645C4 /* PNChartDemoTests.m */; }; 23 0AF7A893182AA9F6003645C4 /* PNChartDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A892182AA9F6003645C4 /* PNChartDemoTests.m */; };
24 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */; }; 24 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */; };
  25 + 91177ED8198DFAC400017E27 /* PNBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177EC9198DFAC400017E27 /* PNBar.m */; };
  26 + 91177ED9198DFAC400017E27 /* PNBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177EC9198DFAC400017E27 /* PNBar.m */; };
  27 + 91177EDA198DFAC400017E27 /* PNBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECB198DFAC400017E27 /* PNBarChart.m */; };
  28 + 91177EDB198DFAC400017E27 /* PNBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECB198DFAC400017E27 /* PNBarChart.m */; };
  29 + 91177EDC198DFAC400017E27 /* PNCircleChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECD198DFAC400017E27 /* PNCircleChart.m */; };
  30 + 91177EDD198DFAC400017E27 /* PNCircleChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECD198DFAC400017E27 /* PNCircleChart.m */; };
  31 + 91177EDE198DFAC400017E27 /* PNLineChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECF198DFAC400017E27 /* PNLineChart.m */; };
  32 + 91177EDF198DFAC400017E27 /* PNLineChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECF198DFAC400017E27 /* PNLineChart.m */; };
  33 + 91177EE0198DFAC400017E27 /* PNLineChartData.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ED1198DFAC400017E27 /* PNLineChartData.m */; };
  34 + 91177EE1198DFAC400017E27 /* PNLineChartData.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ED1198DFAC400017E27 /* PNLineChartData.m */; };
  35 + 91177EE2198DFAC400017E27 /* PNLineChartDataItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ED3198DFAC400017E27 /* PNLineChartDataItem.m */; };
  36 + 91177EE3198DFAC400017E27 /* PNLineChartDataItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ED3198DFAC400017E27 /* PNLineChartDataItem.m */; };
  37 + 91177EE4198DFAC400017E27 /* PNPieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ED5198DFAC400017E27 /* PNPieChart.m */; };
  38 + 91177EE5198DFAC400017E27 /* PNPieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ED5198DFAC400017E27 /* PNPieChart.m */; };
  39 + 91177EE6198DFAC400017E27 /* PNPieChartDataItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ED7198DFAC400017E27 /* PNPieChartDataItem.m */; };
  40 + 91177EE7198DFAC400017E27 /* PNPieChartDataItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ED7198DFAC400017E27 /* PNPieChartDataItem.m */; };
25 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FA23B0F184A5944002DBBA4 /* PCChartsTableViewController.m */; }; 41 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FA23B0F184A5944002DBBA4 /* PCChartsTableViewController.m */; };
26 - 9FE15DF6190BB014004129F5 /* PNBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FE15DE3190BB014004129F5 /* PNBar.m */; };  
27 - 9FE15DF7190BB014004129F5 /* PNBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FE15DE5190BB014004129F5 /* PNBarChart.m */; };  
28 9FE15DF8190BB014004129F5 /* PNChartLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FE15DE9190BB014004129F5 /* PNChartLabel.m */; }; 42 9FE15DF8190BB014004129F5 /* PNChartLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FE15DE9190BB014004129F5 /* PNChartLabel.m */; };
29 - 9FE15DF9190BB014004129F5 /* PNCircleChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FE15DEC190BB014004129F5 /* PNCircleChart.m */; };  
30 9FE15DFA190BB014004129F5 /* PNColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FE15DEE190BB014004129F5 /* PNColor.m */; }; 43 9FE15DFA190BB014004129F5 /* PNColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FE15DEE190BB014004129F5 /* PNColor.m */; };
31 - 9FE15DFB190BB014004129F5 /* PNLineChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FE15DF1190BB014004129F5 /* PNLineChart.m */; };  
32 - 9FE15DFC190BB014004129F5 /* PNLineChartData.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FE15DF3190BB014004129F5 /* PNLineChartData.m */; };  
33 - 9FE15DFD190BB014004129F5 /* PNLineChartDataItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FE15DF5190BB014004129F5 /* PNLineChartDataItem.m */; };  
34 E2C3ED5773A1409C8367CC70 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BA6321352024B1FBA0158B0 /* libPods.a */; }; 44 E2C3ED5773A1409C8367CC70 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BA6321352024B1FBA0158B0 /* libPods.a */; };
35 - F938F7E11917727E00B4448E /* PNPieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = F938F7E01917727E00B4448E /* PNPieChart.m */; };  
36 - F938F7E4191772F200B4448E /* PNPieChartDataItem.m in Sources */ = {isa = PBXBuildFile; fileRef = F938F7E3191772F200B4448E /* PNPieChartDataItem.m */; };  
37 /* End PBXBuildFile section */ 45 /* End PBXBuildFile section */
38 46
39 /* Begin PBXContainerItemProxy section */ 47 /* Begin PBXContainerItemProxy section */
@@ -68,31 +76,31 @@ @@ -68,31 +76,31 @@
68 0AF7A8AD182AAEEF003645C4 /* PCChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PCChartViewController.h; sourceTree = "<group>"; }; 76 0AF7A8AD182AAEEF003645C4 /* PCChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PCChartViewController.h; sourceTree = "<group>"; };
69 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PCChartViewController.m; sourceTree = "<group>"; }; 77 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PCChartViewController.m; sourceTree = "<group>"; };
70 3BA6321352024B1FBA0158B0 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 78 3BA6321352024B1FBA0158B0 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
  79 + 91177EC8198DFAC400017E27 /* PNBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNBar.h; sourceTree = "<group>"; };
  80 + 91177EC9198DFAC400017E27 /* PNBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBar.m; sourceTree = "<group>"; };
  81 + 91177ECA198DFAC400017E27 /* PNBarChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNBarChart.h; sourceTree = "<group>"; };
  82 + 91177ECB198DFAC400017E27 /* PNBarChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBarChart.m; sourceTree = "<group>"; };
  83 + 91177ECC198DFAC400017E27 /* PNCircleChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNCircleChart.h; sourceTree = "<group>"; };
  84 + 91177ECD198DFAC400017E27 /* PNCircleChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNCircleChart.m; sourceTree = "<group>"; };
  85 + 91177ECE198DFAC400017E27 /* PNLineChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNLineChart.h; sourceTree = "<group>"; };
  86 + 91177ECF198DFAC400017E27 /* PNLineChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNLineChart.m; sourceTree = "<group>"; };
  87 + 91177ED0198DFAC400017E27 /* PNLineChartData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNLineChartData.h; sourceTree = "<group>"; };
  88 + 91177ED1198DFAC400017E27 /* PNLineChartData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNLineChartData.m; sourceTree = "<group>"; };
  89 + 91177ED2198DFAC400017E27 /* PNLineChartDataItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNLineChartDataItem.h; sourceTree = "<group>"; };
  90 + 91177ED3198DFAC400017E27 /* PNLineChartDataItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNLineChartDataItem.m; sourceTree = "<group>"; };
  91 + 91177ED4198DFAC400017E27 /* PNPieChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNPieChart.h; sourceTree = "<group>"; };
  92 + 91177ED5198DFAC400017E27 /* PNPieChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNPieChart.m; sourceTree = "<group>"; };
  93 + 91177ED6198DFAC400017E27 /* PNPieChartDataItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNPieChartDataItem.h; sourceTree = "<group>"; };
  94 + 91177ED7198DFAC400017E27 /* PNPieChartDataItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNPieChartDataItem.m; sourceTree = "<group>"; };
71 9FA23B0E184A5944002DBBA4 /* PCChartsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PCChartsTableViewController.h; sourceTree = "<group>"; }; 95 9FA23B0E184A5944002DBBA4 /* PCChartsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PCChartsTableViewController.h; sourceTree = "<group>"; };
72 9FA23B0F184A5944002DBBA4 /* PCChartsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PCChartsTableViewController.m; sourceTree = "<group>"; }; 96 9FA23B0F184A5944002DBBA4 /* PCChartsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PCChartsTableViewController.m; sourceTree = "<group>"; };
73 - 9FE15DE2190BB014004129F5 /* PNBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNBar.h; sourceTree = "<group>"; };  
74 - 9FE15DE3190BB014004129F5 /* PNBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBar.m; sourceTree = "<group>"; };  
75 - 9FE15DE4190BB014004129F5 /* PNBarChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNBarChart.h; sourceTree = "<group>"; };  
76 - 9FE15DE5190BB014004129F5 /* PNBarChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBarChart.m; sourceTree = "<group>"; };  
77 9FE15DE6190BB014004129F5 /* PNChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNChart.h; sourceTree = "<group>"; }; 97 9FE15DE6190BB014004129F5 /* PNChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNChart.h; sourceTree = "<group>"; };
78 9FE15DE7190BB014004129F5 /* PNChartDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNChartDelegate.h; sourceTree = "<group>"; }; 98 9FE15DE7190BB014004129F5 /* PNChartDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNChartDelegate.h; sourceTree = "<group>"; };
79 9FE15DE8190BB014004129F5 /* PNChartLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNChartLabel.h; sourceTree = "<group>"; }; 99 9FE15DE8190BB014004129F5 /* PNChartLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNChartLabel.h; sourceTree = "<group>"; };
80 9FE15DE9190BB014004129F5 /* PNChartLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNChartLabel.m; sourceTree = "<group>"; }; 100 9FE15DE9190BB014004129F5 /* PNChartLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNChartLabel.m; sourceTree = "<group>"; };
81 - 9FE15DEB190BB014004129F5 /* PNCircleChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNCircleChart.h; sourceTree = "<group>"; };  
82 - 9FE15DEC190BB014004129F5 /* PNCircleChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNCircleChart.m; sourceTree = "<group>"; };  
83 9FE15DED190BB014004129F5 /* PNColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNColor.h; sourceTree = "<group>"; }; 101 9FE15DED190BB014004129F5 /* PNColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNColor.h; sourceTree = "<group>"; };
84 9FE15DEE190BB014004129F5 /* PNColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNColor.m; sourceTree = "<group>"; }; 102 9FE15DEE190BB014004129F5 /* PNColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNColor.m; sourceTree = "<group>"; };
85 - 9FE15DF0190BB014004129F5 /* PNLineChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNLineChart.h; sourceTree = "<group>"; };  
86 - 9FE15DF1190BB014004129F5 /* PNLineChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNLineChart.m; sourceTree = "<group>"; };  
87 - 9FE15DF2190BB014004129F5 /* PNLineChartData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNLineChartData.h; sourceTree = "<group>"; };  
88 - 9FE15DF3190BB014004129F5 /* PNLineChartData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNLineChartData.m; sourceTree = "<group>"; };  
89 - 9FE15DF4190BB014004129F5 /* PNLineChartDataItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNLineChartDataItem.h; sourceTree = "<group>"; };  
90 - 9FE15DF5190BB014004129F5 /* PNLineChartDataItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNLineChartDataItem.m; sourceTree = "<group>"; };  
91 F161CF4F7A8C4BD2AB65FB4F /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = "<group>"; }; 103 F161CF4F7A8C4BD2AB65FB4F /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = "<group>"; };
92 - F938F7DF1917727E00B4448E /* PNPieChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNPieChart.h; sourceTree = "<group>"; };  
93 - F938F7E01917727E00B4448E /* PNPieChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNPieChart.m; sourceTree = "<group>"; };  
94 - F938F7E2191772F200B4448E /* PNPieChartDataItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNPieChartDataItem.h; sourceTree = "<group>"; };  
95 - F938F7E3191772F200B4448E /* PNPieChartDataItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNPieChartDataItem.m; sourceTree = "<group>"; };  
96 /* End PBXFileReference section */ 104 /* End PBXFileReference section */
97 105
98 /* Begin PBXFrameworksBuildPhase section */ 106 /* Begin PBXFrameworksBuildPhase section */
@@ -211,64 +219,32 @@ @@ -211,64 +219,32 @@
211 9FE15DE0190BB014004129F5 /* PNChart */ = { 219 9FE15DE0190BB014004129F5 /* PNChart */ = {
212 isa = PBXGroup; 220 isa = PBXGroup;
213 children = ( 221 children = (
214 - F938F7DE191770FE00B4448E /* PNPieChart */,  
215 - 9FE15DE1190BB014004129F5 /* PNBarChart */,  
216 9FE15DE6190BB014004129F5 /* PNChart.h */, 222 9FE15DE6190BB014004129F5 /* PNChart.h */,
217 9FE15DE7190BB014004129F5 /* PNChartDelegate.h */, 223 9FE15DE7190BB014004129F5 /* PNChartDelegate.h */,
218 9FE15DE8190BB014004129F5 /* PNChartLabel.h */, 224 9FE15DE8190BB014004129F5 /* PNChartLabel.h */,
219 9FE15DE9190BB014004129F5 /* PNChartLabel.m */, 225 9FE15DE9190BB014004129F5 /* PNChartLabel.m */,
220 - 9FE15DEA190BB014004129F5 /* PNCircleChart */,  
221 9FE15DED190BB014004129F5 /* PNColor.h */, 226 9FE15DED190BB014004129F5 /* PNColor.h */,
222 9FE15DEE190BB014004129F5 /* PNColor.m */, 227 9FE15DEE190BB014004129F5 /* PNColor.m */,
223 - 9FE15DEF190BB014004129F5 /* PNLineChart */, 228 + 91177EC8198DFAC400017E27 /* PNBar.h */,
  229 + 91177EC9198DFAC400017E27 /* PNBar.m */,
  230 + 91177ECA198DFAC400017E27 /* PNBarChart.h */,
  231 + 91177ECB198DFAC400017E27 /* PNBarChart.m */,
  232 + 91177ECC198DFAC400017E27 /* PNCircleChart.h */,
  233 + 91177ECD198DFAC400017E27 /* PNCircleChart.m */,
  234 + 91177ECE198DFAC400017E27 /* PNLineChart.h */,
  235 + 91177ECF198DFAC400017E27 /* PNLineChart.m */,
  236 + 91177ED0198DFAC400017E27 /* PNLineChartData.h */,
  237 + 91177ED1198DFAC400017E27 /* PNLineChartData.m */,
  238 + 91177ED2198DFAC400017E27 /* PNLineChartDataItem.h */,
  239 + 91177ED3198DFAC400017E27 /* PNLineChartDataItem.m */,
  240 + 91177ED4198DFAC400017E27 /* PNPieChart.h */,
  241 + 91177ED5198DFAC400017E27 /* PNPieChart.m */,
  242 + 91177ED6198DFAC400017E27 /* PNPieChartDataItem.h */,
  243 + 91177ED7198DFAC400017E27 /* PNPieChartDataItem.m */,
224 ); 244 );
225 path = PNChart; 245 path = PNChart;
226 sourceTree = "<group>"; 246 sourceTree = "<group>";
227 }; 247 };
228 - 9FE15DE1190BB014004129F5 /* PNBarChart */ = {  
229 - isa = PBXGroup;  
230 - children = (  
231 - 9FE15DE2190BB014004129F5 /* PNBar.h */,  
232 - 9FE15DE3190BB014004129F5 /* PNBar.m */,  
233 - 9FE15DE4190BB014004129F5 /* PNBarChart.h */,  
234 - 9FE15DE5190BB014004129F5 /* PNBarChart.m */,  
235 - );  
236 - path = PNBarChart;  
237 - sourceTree = "<group>";  
238 - };  
239 - 9FE15DEA190BB014004129F5 /* PNCircleChart */ = {  
240 - isa = PBXGroup;  
241 - children = (  
242 - 9FE15DEB190BB014004129F5 /* PNCircleChart.h */,  
243 - 9FE15DEC190BB014004129F5 /* PNCircleChart.m */,  
244 - );  
245 - path = PNCircleChart;  
246 - sourceTree = "<group>";  
247 - };  
248 - 9FE15DEF190BB014004129F5 /* PNLineChart */ = {  
249 - isa = PBXGroup;  
250 - children = (  
251 - 9FE15DF0190BB014004129F5 /* PNLineChart.h */,  
252 - 9FE15DF1190BB014004129F5 /* PNLineChart.m */,  
253 - 9FE15DF2190BB014004129F5 /* PNLineChartData.h */,  
254 - 9FE15DF3190BB014004129F5 /* PNLineChartData.m */,  
255 - 9FE15DF4190BB014004129F5 /* PNLineChartDataItem.h */,  
256 - 9FE15DF5190BB014004129F5 /* PNLineChartDataItem.m */,  
257 - );  
258 - path = PNLineChart;  
259 - sourceTree = "<group>";  
260 - };  
261 - F938F7DE191770FE00B4448E /* PNPieChart */ = {  
262 - isa = PBXGroup;  
263 - children = (  
264 - F938F7DF1917727E00B4448E /* PNPieChart.h */,  
265 - F938F7E01917727E00B4448E /* PNPieChart.m */,  
266 - F938F7E2191772F200B4448E /* PNPieChartDataItem.h */,  
267 - F938F7E3191772F200B4448E /* PNPieChartDataItem.m */,  
268 - );  
269 - path = PNPieChart;  
270 - sourceTree = "<group>";  
271 - };  
272 /* End PBXGroup section */ 248 /* End PBXGroup section */
273 249
274 /* Begin PBXNativeTarget section */ 250 /* Begin PBXNativeTarget section */
@@ -402,19 +378,19 @@ @@ -402,19 +378,19 @@
402 isa = PBXSourcesBuildPhase; 378 isa = PBXSourcesBuildPhase;
403 buildActionMask = 2147483647; 379 buildActionMask = 2147483647;
404 files = ( 380 files = (
405 - 9FE15DFB190BB014004129F5 /* PNLineChart.m in Sources */, 381 + 91177EDE198DFAC400017E27 /* PNLineChart.m in Sources */,
406 9FE15DF8190BB014004129F5 /* PNChartLabel.m in Sources */, 382 9FE15DF8190BB014004129F5 /* PNChartLabel.m in Sources */,
  383 + 91177EDC198DFAC400017E27 /* PNCircleChart.m in Sources */,
407 9FE15DFA190BB014004129F5 /* PNColor.m in Sources */, 384 9FE15DFA190BB014004129F5 /* PNColor.m in Sources */,
408 - 9FE15DF6190BB014004129F5 /* PNBar.m in Sources */, 385 + 91177ED8198DFAC400017E27 /* PNBar.m in Sources */,
  386 + 91177EE2198DFAC400017E27 /* PNLineChartDataItem.m in Sources */,
409 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */, 387 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */,
410 - 9FE15DFD190BB014004129F5 /* PNLineChartDataItem.m in Sources */, 388 + 91177EDA198DFAC400017E27 /* PNBarChart.m in Sources */,
  389 + 91177EE6198DFAC400017E27 /* PNPieChartDataItem.m in Sources */,
411 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */, 390 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */,
412 - 9FE15DF9190BB014004129F5 /* PNCircleChart.m in Sources */, 391 + 91177EE0198DFAC400017E27 /* PNLineChartData.m in Sources */,
413 - F938F7E4191772F200B4448E /* PNPieChartDataItem.m in Sources */,  
414 0AF7A874182AA9F6003645C4 /* main.m in Sources */, 392 0AF7A874182AA9F6003645C4 /* main.m in Sources */,
415 - 9FE15DFC190BB014004129F5 /* PNLineChartData.m in Sources */, 393 + 91177EE4198DFAC400017E27 /* PNPieChart.m in Sources */,
416 - 9FE15DF7190BB014004129F5 /* PNBarChart.m in Sources */,  
417 - F938F7E11917727E00B4448E /* PNPieChart.m in Sources */,  
418 0AF7A878182AA9F6003645C4 /* PCAppDelegate.m in Sources */, 394 0AF7A878182AA9F6003645C4 /* PCAppDelegate.m in Sources */,
419 ); 395 );
420 runOnlyForDeploymentPostprocessing = 0; 396 runOnlyForDeploymentPostprocessing = 0;
@@ -423,7 +399,15 @@ @@ -423,7 +399,15 @@
423 isa = PBXSourcesBuildPhase; 399 isa = PBXSourcesBuildPhase;
424 buildActionMask = 2147483647; 400 buildActionMask = 2147483647;
425 files = ( 401 files = (
  402 + 91177EE7198DFAC400017E27 /* PNPieChartDataItem.m in Sources */,
  403 + 91177EE1198DFAC400017E27 /* PNLineChartData.m in Sources */,
  404 + 91177EDF198DFAC400017E27 /* PNLineChart.m in Sources */,
  405 + 91177EDD198DFAC400017E27 /* PNCircleChart.m in Sources */,
  406 + 91177EE3198DFAC400017E27 /* PNLineChartDataItem.m in Sources */,
426 0AF7A893182AA9F6003645C4 /* PNChartDemoTests.m in Sources */, 407 0AF7A893182AA9F6003645C4 /* PNChartDemoTests.m in Sources */,
  408 + 91177EE5198DFAC400017E27 /* PNPieChart.m in Sources */,
  409 + 91177EDB198DFAC400017E27 /* PNBarChart.m in Sources */,
  410 + 91177ED9198DFAC400017E27 /* PNBar.m in Sources */,
427 ); 411 );
428 runOnlyForDeploymentPostprocessing = 0; 412 runOnlyForDeploymentPostprocessing = 0;
429 }; 413 };
@@ -119,8 +119,13 @@ @@ -119,8 +119,13 @@
119 [self.barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; 119 [self.barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]];
120 [self.barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]]; 120 [self.barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]];
121 [self.barChart setStrokeColors:@[PNGreen,PNGreen,PNRed,PNGreen,PNGreen,PNYellow,PNGreen]]; 121 [self.barChart setStrokeColors:@[PNGreen,PNGreen,PNRed,PNGreen,PNGreen,PNYellow,PNGreen]];
  122 + // Adding gradient
  123 + self.barChart.barColorGradientStart = [UIColor blueColor];
  124 +
122 [self.barChart strokeChart]; 125 [self.barChart strokeChart];
123 126
  127 +
  128 +
124 self.barChart.delegate = self; 129 self.barChart.delegate = self;
125 130
126 [viewController.view addSubview:barChartLabel]; 131 [viewController.view addSubview:barChartLabel];
@@ -142,6 +147,7 @@ @@ -142,6 +147,7 @@
142 PNCircleChart * circleChart = [[PNCircleChart alloc] initWithFrame:CGRectMake(0, 80.0, SCREEN_WIDTH, 100.0) andTotal:@100 andCurrent:@60 andClockwise:YES andShadow:YES]; 147 PNCircleChart * circleChart = [[PNCircleChart alloc] initWithFrame:CGRectMake(0, 80.0, SCREEN_WIDTH, 100.0) andTotal:@100 andCurrent:@60 andClockwise:YES andShadow:YES];
143 circleChart.backgroundColor = [UIColor clearColor]; 148 circleChart.backgroundColor = [UIColor clearColor];
144 [circleChart setStrokeColor:PNGreen]; 149 [circleChart setStrokeColor:PNGreen];
  150 + [circleChart setStrokeColorGradientStart:[UIColor blueColor]];
145 [circleChart strokeChart]; 151 [circleChart strokeChart];
146 152
147 [viewController.view addSubview:circleChartLabel]; 153 [viewController.view addSubview:circleChartLabel];
@@ -152,7 +158,7 @@ @@ -152,7 +158,7 @@
152 }else if ([segue.identifier isEqualToString:@"pieChart"]) 158 }else if ([segue.identifier isEqualToString:@"pieChart"])
153 { 159 {
154 160
155 - //Add LineChart 161 + //Add PieChart
156 UILabel * pieChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; 162 UILabel * pieChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)];
157 pieChartLabel.text = @"Pie Chart"; 163 pieChartLabel.text = @"Pie Chart";
158 pieChartLabel.textColor = PNFreshGreen; 164 pieChartLabel.textColor = PNFreshGreen;
@@ -5,6 +5,6 @@ DEPENDENCIES: @@ -5,6 +5,6 @@ DEPENDENCIES:
5 - UICountingLabel (~> 1.0.0) 5 - UICountingLabel (~> 1.0.0)
6 6
7 SPEC CHECKSUMS: 7 SPEC CHECKSUMS:
8 - UICountingLabel: bb976960c0130785a600aac592954c23eb395096 8 + UICountingLabel: 0a0e9e34bf4690dbd127aaec552d19ed938087a9
9 9
10 COCOAPODS: 0.32.1 10 COCOAPODS: 0.32.1