Merge branch 'master' of github.com:kevinzhow/PNChart
Showing
10 changed files
with
147 additions
and
57 deletions
| @@ -22,33 +22,47 @@ | @@ -22,33 +22,47 @@ | ||
| 22 | 22 | ||
| 23 | @implementation PNBarChart | 23 | @implementation PNBarChart |
| 24 | 24 | ||
| 25 | +- (id)initWithCoder:(NSCoder *)aDecoder | ||
| 26 | +{ | ||
| 27 | + self = [super initWithCoder:aDecoder]; | ||
| 28 | + | ||
| 29 | + if (self) { | ||
| 30 | + [self setupDefaultValues]; | ||
| 31 | + } | ||
| 32 | + return self; | ||
| 33 | +} | ||
| 34 | + | ||
| 25 | - (id)initWithFrame:(CGRect)frame | 35 | - (id)initWithFrame:(CGRect)frame |
| 26 | { | 36 | { |
| 27 | self = [super initWithFrame:frame]; | 37 | self = [super initWithFrame:frame]; |
| 28 | 38 | ||
| 29 | if (self) { | 39 | if (self) { |
| 30 | - self.backgroundColor = [UIColor whiteColor]; | 40 | + [self setupDefaultValues]; |
| 31 | - self.clipsToBounds = YES; | ||
| 32 | - _showLabel = YES; | ||
| 33 | - _barBackgroundColor = PNLightGrey; | ||
| 34 | - _labelTextColor = [UIColor grayColor]; | ||
| 35 | - _labelFont = [UIFont systemFontOfSize:11.0f]; | ||
| 36 | - _xChartLabels = [NSMutableArray array]; | ||
| 37 | - _yChartLabels = [NSMutableArray array]; | ||
| 38 | - _bars = [NSMutableArray array]; | ||
| 39 | - _xLabelSkip = 1; | ||
| 40 | - _yLabelSum = 4; | ||
| 41 | - _labelMarginTop = 0; | ||
| 42 | - _chartMargin = 15.0; | ||
| 43 | - _barRadius = 2.0; | ||
| 44 | - _showChartBorder = NO; | ||
| 45 | - _yChartLabelWidth = 18; | ||
| 46 | - _rotateForXAxisText = false; | ||
| 47 | } | 41 | } |
| 48 | 42 | ||
| 49 | return self; | 43 | return self; |
| 50 | } | 44 | } |
| 51 | 45 | ||
| 46 | +- (void)setupDefaultValues | ||
| 47 | +{ | ||
| 48 | + self.backgroundColor = [UIColor whiteColor]; | ||
| 49 | + self.clipsToBounds = YES; | ||
| 50 | + _showLabel = YES; | ||
| 51 | + _barBackgroundColor = PNLightGrey; | ||
| 52 | + _labelTextColor = [UIColor grayColor]; | ||
| 53 | + _labelFont = [UIFont systemFontOfSize:11.0f]; | ||
| 54 | + _xChartLabels = [NSMutableArray array]; | ||
| 55 | + _yChartLabels = [NSMutableArray array]; | ||
| 56 | + _bars = [NSMutableArray array]; | ||
| 57 | + _xLabelSkip = 1; | ||
| 58 | + _yLabelSum = 4; | ||
| 59 | + _labelMarginTop = 0; | ||
| 60 | + _chartMargin = 15.0; | ||
| 61 | + _barRadius = 2.0; | ||
| 62 | + _showChartBorder = NO; | ||
| 63 | + _yChartLabelWidth = 18; | ||
| 64 | + _rotateForXAxisText = false; | ||
| 65 | +} | ||
| 52 | 66 | ||
| 53 | - (void)setYValues:(NSArray *)yValues | 67 | - (void)setYValues:(NSArray *)yValues |
| 54 | { | 68 | { |
| @@ -125,12 +139,12 @@ | @@ -125,12 +139,12 @@ | ||
| 125 | 139 | ||
| 126 | if (labelAddCount == _xLabelSkip) { | 140 | if (labelAddCount == _xLabelSkip) { |
| 127 | NSString *labelText = [_xLabels[index] description]; | 141 | NSString *labelText = [_xLabels[index] description]; |
| 128 | - PNChartLabel * label = [[PNChartLabel alloc] initWithFrame:CGRectZero]; | 142 | + PNChartLabel * label = [[PNChartLabel alloc] initWithFrame:CGRectMake(0, 0, _xLabelWidth, xLabelHeight)]; |
| 129 | label.font = _labelFont; | 143 | label.font = _labelFont; |
| 130 | label.textColor = _labelTextColor; | 144 | label.textColor = _labelTextColor; |
| 131 | [label setTextAlignment:NSTextAlignmentCenter]; | 145 | [label setTextAlignment:NSTextAlignmentCenter]; |
| 132 | label.text = labelText; | 146 | label.text = labelText; |
| 133 | - [label sizeToFit]; | 147 | + //[label sizeToFit]; |
| 134 | CGFloat labelXPosition; | 148 | CGFloat labelXPosition; |
| 135 | if (_rotateForXAxisText){ | 149 | if (_rotateForXAxisText){ |
| 136 | label.transform = CGAffineTransformMakeRotation(M_PI / 4); | 150 | label.transform = CGAffineTransformMakeRotation(M_PI / 4); |
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | #import <Foundation/Foundation.h> | 9 | #import <Foundation/Foundation.h> |
| 10 | 10 | ||
| 11 | @protocol PNChartDelegate <NSObject> | 11 | @protocol PNChartDelegate <NSObject> |
| 12 | - | 12 | +@optional |
| 13 | /** | 13 | /** |
| 14 | * Callback method that gets invoked when the user taps on the chart line. | 14 | * Callback method that gets invoked when the user taps on the chart line. |
| 15 | */ | 15 | */ |
| @@ -27,4 +27,4 @@ | @@ -27,4 +27,4 @@ | ||
| 27 | */ | 27 | */ |
| 28 | - (void)userClickedOnBarAtIndex:(NSInteger)barIndex; | 28 | - (void)userClickedOnBarAtIndex:(NSInteger)barIndex; |
| 29 | 29 | ||
| 30 | -@end | 30 | +@end |
| @@ -19,8 +19,11 @@ | @@ -19,8 +19,11 @@ | ||
| 19 | self.backgroundColor = [UIColor clearColor]; | 19 | self.backgroundColor = [UIColor clearColor]; |
| 20 | self.textAlignment = NSTextAlignmentCenter; | 20 | self.textAlignment = NSTextAlignmentCenter; |
| 21 | self.userInteractionEnabled = YES; | 21 | self.userInteractionEnabled = YES; |
| 22 | - self.minimumScaleFactor = 0.8; | ||
| 23 | self.adjustsFontSizeToFitWidth = YES; | 22 | self.adjustsFontSizeToFitWidth = YES; |
| 23 | + self.numberOfLines = 0; | ||
| 24 | + /* if you want to see ... in large labels un-comment this line | ||
| 25 | + self.minimumScaleFactor = 0.8; | ||
| 26 | + */ | ||
| 24 | } | 27 | } |
| 25 | 28 | ||
| 26 | return self; | 29 | return self; |
| @@ -29,6 +29,30 @@ typedef NS_ENUM (NSUInteger, PNChartFormatType) { | @@ -29,6 +29,30 @@ typedef NS_ENUM (NSUInteger, PNChartFormatType) { | ||
| 29 | clockwise:(BOOL)clockwise | 29 | clockwise:(BOOL)clockwise |
| 30 | shadow:(BOOL)hasBackgroundShadow; | 30 | shadow:(BOOL)hasBackgroundShadow; |
| 31 | 31 | ||
| 32 | +- (id)initWithFrame:(CGRect)frame | ||
| 33 | + total:(NSNumber *)total | ||
| 34 | + current:(NSNumber *)current | ||
| 35 | + clockwise:(BOOL)clockwise | ||
| 36 | + shadow:(BOOL)hasBackgroundShadow | ||
| 37 | + shadowColor:(UIColor *)backgroundShadowColor; | ||
| 38 | + | ||
| 39 | +- (id)initWithFrame:(CGRect)frame | ||
| 40 | + total:(NSNumber *)total | ||
| 41 | + current:(NSNumber *)current | ||
| 42 | + clockwise:(BOOL)clockwise | ||
| 43 | + shadow:(BOOL)hasBackgroundShadow | ||
| 44 | + shadowColor:(UIColor *)backgroundShadowColor | ||
| 45 | +displayCountingLabel:(BOOL)displayCountingLabel; | ||
| 46 | + | ||
| 47 | +- (id)initWithFrame:(CGRect)frame | ||
| 48 | + total:(NSNumber *)total | ||
| 49 | + current:(NSNumber *)current | ||
| 50 | + clockwise:(BOOL)clockwise | ||
| 51 | + shadow:(BOOL)hasBackgroundShadow | ||
| 52 | + shadowColor:(UIColor *)backgroundShadowColor | ||
| 53 | +displayCountingLabel:(BOOL)displayCountingLabel | ||
| 54 | + overrideLineWidth:(NSNumber *)overrideLineWidth; | ||
| 55 | + | ||
| 32 | @property (strong, nonatomic) UICountingLabel *countingLabel; | 56 | @property (strong, nonatomic) UICountingLabel *countingLabel; |
| 33 | @property (nonatomic) UIColor *strokeColor; | 57 | @property (nonatomic) UIColor *strokeColor; |
| 34 | @property (nonatomic) UIColor *strokeColorGradientStart; | 58 | @property (nonatomic) UIColor *strokeColorGradientStart; |
| @@ -43,4 +67,6 @@ typedef NS_ENUM (NSUInteger, PNChartFormatType) { | @@ -43,4 +67,6 @@ typedef NS_ENUM (NSUInteger, PNChartFormatType) { | ||
| 43 | @property (nonatomic) CAShapeLayer *gradientMask; | 67 | @property (nonatomic) CAShapeLayer *gradientMask; |
| 44 | @property (nonatomic) CAShapeLayer *circleBackground; | 68 | @property (nonatomic) CAShapeLayer *circleBackground; |
| 45 | 69 | ||
| 70 | +@property (nonatomic) BOOL displayCountingLabel; | ||
| 71 | + | ||
| 46 | @end | 72 | @end |
| @@ -13,12 +13,53 @@ | @@ -13,12 +13,53 @@ | ||
| 13 | 13 | ||
| 14 | @implementation PNCircleChart | 14 | @implementation PNCircleChart |
| 15 | 15 | ||
| 16 | +- (id)initWithFrame:(CGRect)frame total:(NSNumber *)total current:(NSNumber *)current clockwise:(BOOL)clockwise shadow:(BOOL)hasBackgroundShadow { | ||
| 17 | + | ||
| 18 | + return [self initWithFrame:frame | ||
| 19 | + total:total | ||
| 20 | + current:current | ||
| 21 | + clockwise:clockwise | ||
| 22 | + shadow:shadow | ||
| 23 | + shadowColor:PNGreen | ||
| 24 | + displayCountingLabel:YES | ||
| 25 | + overrideLineWidth:@8.0f]; | ||
| 26 | + | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +- (id)initWithFrame:(CGRect)frame total:(NSNumber *)total current:(NSNumber *)current clockwise:(BOOL)clockwise shadow:(BOOL)hasBackgroundShadow shadowColor:(UIColor *)backgroundShadowColor { | ||
| 30 | + | ||
| 31 | + return [self initWithFrame:frame | ||
| 32 | + total:total | ||
| 33 | + current:current | ||
| 34 | + clockwise:clockwise | ||
| 35 | + shadow:shadow | ||
| 36 | + shadowColor:backgroundShadowColor | ||
| 37 | + displayCountingLabel:YES | ||
| 38 | + overrideLineWidth:@8.0f]; | ||
| 39 | + | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +- (id)initWithFrame:(CGRect)frame total:(NSNumber *)total current:(NSNumber *)current clockwise:(BOOL)clockwise shadow:(BOOL)hasBackgroundShadow shadowColor:(UIColor *)backgroundShadowColor displayCountingLabel:(BOOL)displayCountingLabel { | ||
| 43 | + | ||
| 44 | + return [self initWithFrame:frame | ||
| 45 | + total:total | ||
| 46 | + current:current | ||
| 47 | + clockwise:clockwise | ||
| 48 | + shadow:shadow | ||
| 49 | + shadowColor:PNGreen | ||
| 50 | + displayCountingLabel:displayCountingLabel | ||
| 51 | + overrideLineWidth:@8.0f]; | ||
| 52 | + | ||
| 53 | +} | ||
| 16 | 54 | ||
| 17 | - (id)initWithFrame:(CGRect)frame | 55 | - (id)initWithFrame:(CGRect)frame |
| 18 | total:(NSNumber *)total | 56 | total:(NSNumber *)total |
| 19 | current:(NSNumber *)current | 57 | current:(NSNumber *)current |
| 20 | clockwise:(BOOL)clockwise | 58 | clockwise:(BOOL)clockwise |
| 21 | shadow:(BOOL)hasBackgroundShadow | 59 | shadow:(BOOL)hasBackgroundShadow |
| 60 | + shadowColor:(UIColor *)backgroundShadowColor | ||
| 61 | +displayCountingLabel:(BOOL)displayCountingLabel | ||
| 62 | + overrideLineWidth:(NSNumber *)overrideLineWidth | ||
| 22 | { | 63 | { |
| 23 | self = [super initWithFrame:frame]; | 64 | self = [super initWithFrame:frame]; |
| 24 | 65 | ||
| @@ -28,13 +69,16 @@ | @@ -28,13 +69,16 @@ | ||
| 28 | _strokeColor = PNFreshGreen; | 69 | _strokeColor = PNFreshGreen; |
| 29 | _duration = 1.0; | 70 | _duration = 1.0; |
| 30 | _chartType = PNChartFormatTypePercent; | 71 | _chartType = PNChartFormatTypePercent; |
| 72 | + | ||
| 73 | + _displayCountingLabel = displayCountingLabel; | ||
| 31 | 74 | ||
| 32 | CGFloat startAngle = clockwise ? -90.0f : 270.0f; | 75 | CGFloat startAngle = clockwise ? -90.0f : 270.0f; |
| 33 | CGFloat endAngle = clockwise ? -90.01f : 270.01f; | 76 | CGFloat endAngle = clockwise ? -90.01f : 270.01f; |
| 34 | 77 | ||
| 35 | - _lineWidth = @8.0f; | 78 | + _lineWidth = overrideLineWidth; |
| 36 | - UIBezierPath *circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.center.x, self.center.y) | 79 | + |
| 37 | - radius:(self.frame.size.height * 0.5) - [_lineWidth floatValue] | 80 | + UIBezierPath *circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.bounds.size.width/2.0f, self.bounds.size.height/2.0f) |
| 81 | + radius:(self.frame.size.height * 0.5) - ([_lineWidth floatValue]/2.0f) | ||
| 38 | startAngle:DEGREES_TO_RADIANS(startAngle) | 82 | startAngle:DEGREES_TO_RADIANS(startAngle) |
| 39 | endAngle:DEGREES_TO_RADIANS(endAngle) | 83 | endAngle:DEGREES_TO_RADIANS(endAngle) |
| 40 | clockwise:clockwise]; | 84 | clockwise:clockwise]; |
| @@ -51,7 +95,7 @@ | @@ -51,7 +95,7 @@ | ||
| 51 | _circleBackground.lineCap = kCALineCapRound; | 95 | _circleBackground.lineCap = kCALineCapRound; |
| 52 | _circleBackground.fillColor = [UIColor clearColor].CGColor; | 96 | _circleBackground.fillColor = [UIColor clearColor].CGColor; |
| 53 | _circleBackground.lineWidth = [_lineWidth floatValue]; | 97 | _circleBackground.lineWidth = [_lineWidth floatValue]; |
| 54 | - _circleBackground.strokeColor = (hasBackgroundShadow ? PNLightYellow.CGColor : [UIColor clearColor].CGColor); | 98 | + _circleBackground.strokeColor = (hasBackgroundShadow ? backgroundShadowColor.CGColor : [UIColor clearColor].CGColor); |
| 55 | _circleBackground.strokeEnd = 1.0; | 99 | _circleBackground.strokeEnd = 1.0; |
| 56 | _circleBackground.zPosition = -1; | 100 | _circleBackground.zPosition = -1; |
| 57 | 101 | ||
| @@ -65,7 +109,9 @@ | @@ -65,7 +109,9 @@ | ||
| 65 | [_countingLabel setBackgroundColor:[UIColor clearColor]]; | 109 | [_countingLabel setBackgroundColor:[UIColor clearColor]]; |
| 66 | [_countingLabel setCenter:CGPointMake(self.center.x, self.center.y)]; | 110 | [_countingLabel setCenter:CGPointMake(self.center.x, self.center.y)]; |
| 67 | _countingLabel.method = UILabelCountingMethodEaseInOut; | 111 | _countingLabel.method = UILabelCountingMethodEaseInOut; |
| 68 | - [self addSubview:_countingLabel];; | 112 | + if (_displayCountingLabel) { |
| 113 | + [self addSubview:_countingLabel]; | ||
| 114 | + } | ||
| 69 | } | 115 | } |
| 70 | 116 | ||
| 71 | return self; | 117 | return self; |
| @@ -76,21 +122,23 @@ | @@ -76,21 +122,23 @@ | ||
| 76 | { | 122 | { |
| 77 | // Add counting label | 123 | // Add counting label |
| 78 | 124 | ||
| 79 | - NSString *format; | 125 | + if (_displayCountingLabel) { |
| 80 | - switch (self.chartType) { | 126 | + NSString *format; |
| 81 | - case PNChartFormatTypePercent: | 127 | + switch (self.chartType) { |
| 82 | - format = @"%d%%"; | 128 | + case PNChartFormatTypePercent: |
| 83 | - break; | 129 | + format = @"%d%%"; |
| 84 | - case PNChartFormatTypeDollar: | 130 | + break; |
| 85 | - format = @"$%d"; | 131 | + case PNChartFormatTypeDollar: |
| 86 | - break; | 132 | + format = @"$%d"; |
| 87 | - case PNChartFormatTypeNone: | 133 | + break; |
| 88 | - default: | 134 | + case PNChartFormatTypeNone: |
| 89 | - format = @"%d"; | 135 | + default: |
| 90 | - break; | 136 | + format = @"%d"; |
| 137 | + break; | ||
| 138 | + } | ||
| 139 | + self.countingLabel.format = format; | ||
| 140 | + [self addSubview:self.countingLabel]; | ||
| 91 | } | 141 | } |
| 92 | - self.countingLabel.format = format; | ||
| 93 | - [self addSubview:self.countingLabel]; | ||
| 94 | 142 | ||
| 95 | 143 | ||
| 96 | // Add circle params | 144 | // Add circle params |
| @@ -172,7 +220,10 @@ | @@ -172,7 +220,10 @@ | ||
| 172 | } | 220 | } |
| 173 | [_circle addAnimation:pathAnimation forKey:@"strokeEndAnimation"]; | 221 | [_circle addAnimation:pathAnimation forKey:@"strokeEndAnimation"]; |
| 174 | 222 | ||
| 175 | - [self.countingLabel countFrom:fmin([_current floatValue], [_total floatValue]) to:fmin([current floatValue], [_total floatValue]) withDuration:self.duration]; | 223 | + if (_displayCountingLabel) { |
| 224 | + [self.countingLabel countFrom:fmin([_current floatValue], [_total floatValue]) to:fmin([current floatValue], [_total floatValue]) withDuration:self.duration]; | ||
| 225 | + } | ||
| 226 | + | ||
| 176 | _current = current; | 227 | _current = current; |
| 177 | } | 228 | } |
| 178 | 229 |
| @@ -20,8 +20,6 @@ | @@ -20,8 +20,6 @@ | ||
| 20 | @property (nonatomic) NSMutableArray *chartPath; // Array of line path, one for each line. | 20 | @property (nonatomic) NSMutableArray *chartPath; // Array of line path, one for each line. |
| 21 | @property (nonatomic) NSMutableArray *pointPath; // Array of point path, one for each line | 21 | @property (nonatomic) NSMutableArray *pointPath; // Array of point path, one for each line |
| 22 | 22 | ||
| 23 | -- (void)setDefaultValues; | ||
| 24 | - | ||
| 25 | @end | 23 | @end |
| 26 | 24 | ||
| 27 | @implementation PNLineChart | 25 | @implementation PNLineChart |
| @@ -33,7 +31,7 @@ | @@ -33,7 +31,7 @@ | ||
| 33 | self = [super initWithCoder:coder]; | 31 | self = [super initWithCoder:coder]; |
| 34 | 32 | ||
| 35 | if (self) { | 33 | if (self) { |
| 36 | - [self setDefaultValues]; | 34 | + [self setupDefaultValues]; |
| 37 | } | 35 | } |
| 38 | 36 | ||
| 39 | return self; | 37 | return self; |
| @@ -44,7 +42,7 @@ | @@ -44,7 +42,7 @@ | ||
| 44 | self = [super initWithFrame:frame]; | 42 | self = [super initWithFrame:frame]; |
| 45 | 43 | ||
| 46 | if (self) { | 44 | if (self) { |
| 47 | - [self setDefaultValues]; | 45 | + [self setupDefaultValues]; |
| 48 | } | 46 | } |
| 49 | 47 | ||
| 50 | return self; | 48 | return self; |
| @@ -646,7 +644,7 @@ | @@ -646,7 +644,7 @@ | ||
| 646 | 644 | ||
| 647 | #pragma mark private methods | 645 | #pragma mark private methods |
| 648 | 646 | ||
| 649 | -- (void)setDefaultValues | 647 | +- (void)setupDefaultValues |
| 650 | { | 648 | { |
| 651 | // Initialization code | 649 | // Initialization code |
| 652 | self.backgroundColor = [UIColor whiteColor]; | 650 | self.backgroundColor = [UIColor whiteColor]; |
| @@ -11,13 +11,13 @@ | @@ -11,13 +11,13 @@ | ||
| 11 | { | 11 | { |
| 12 | self = [super init]; | 12 | self = [super init]; |
| 13 | if (self) { | 13 | if (self) { |
| 14 | - [self setDefaultValues]; | 14 | + [self setupDefaultValues]; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | return self; | 17 | return self; |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | -- (void)setDefaultValues | 20 | +- (void)setupDefaultValues |
| 21 | { | 21 | { |
| 22 | _inflexionPointStyle = PNLineChartPointStyleNone; | 22 | _inflexionPointStyle = PNLineChartPointStyleNone; |
| 23 | _inflexionPointWidth = 6.f; | 23 | _inflexionPointWidth = 6.f; |
| @@ -46,8 +46,6 @@ | @@ -46,8 +46,6 @@ | ||
| 46 | 46 | ||
| 47 | @property (nonatomic) BOOL isForUpdate; | 47 | @property (nonatomic) BOOL isForUpdate; |
| 48 | 48 | ||
| 49 | -- (void)setDefaultValues; | ||
| 50 | - | ||
| 51 | @end | 49 | @end |
| 52 | 50 | ||
| 53 | 51 | ||
| @@ -60,7 +58,7 @@ | @@ -60,7 +58,7 @@ | ||
| 60 | self = [super initWithCoder:coder]; | 58 | self = [super initWithCoder:coder]; |
| 61 | 59 | ||
| 62 | if (self) { | 60 | if (self) { |
| 63 | - [self setDefaultValues]; | 61 | + [self setupDefaultValues]; |
| 64 | } | 62 | } |
| 65 | return self; | 63 | return self; |
| 66 | } | 64 | } |
| @@ -70,7 +68,7 @@ | @@ -70,7 +68,7 @@ | ||
| 70 | self = [super initWithFrame:frame]; | 68 | self = [super initWithFrame:frame]; |
| 71 | 69 | ||
| 72 | if (self) { | 70 | if (self) { |
| 73 | - [self setDefaultValues]; | 71 | + [self setupDefaultValues]; |
| 74 | } | 72 | } |
| 75 | return self; | 73 | return self; |
| 76 | } | 74 | } |
| @@ -81,7 +79,7 @@ | @@ -81,7 +79,7 @@ | ||
| 81 | [self vectorYSetup]; | 79 | [self vectorYSetup]; |
| 82 | } | 80 | } |
| 83 | 81 | ||
| 84 | -- (void)setDefaultValues | 82 | +- (void)setupDefaultValues |
| 85 | { | 83 | { |
| 86 | // Initialization code | 84 | // Initialization code |
| 87 | self.backgroundColor = [UIColor whiteColor]; | 85 | self.backgroundColor = [UIColor whiteColor]; |
| @@ -14,13 +14,13 @@ | @@ -14,13 +14,13 @@ | ||
| 14 | { | 14 | { |
| 15 | self = [super init]; | 15 | self = [super init]; |
| 16 | if (self) { | 16 | if (self) { |
| 17 | - [self setDefaultValues]; | 17 | + [self setupDefaultValues]; |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | return self; | 20 | return self; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | -- (void)setDefaultValues | 23 | +- (void)setupDefaultValues |
| 24 | { | 24 | { |
| 25 | _inflexionPointStyle = PNScatterChartPointStyleCircle; | 25 | _inflexionPointStyle = PNScatterChartPointStyleCircle; |
| 26 | _fillColor = [UIColor grayColor]; | 26 | _fillColor = [UIColor grayColor]; |
| @@ -88,7 +88,7 @@ PNBarChart * barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(0, 135.0, S | @@ -88,7 +88,7 @@ PNBarChart * barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(0, 135.0, S | ||
| 88 | 88 | ||
| 89 | //For Circle Chart | 89 | //For Circle Chart |
| 90 | 90 | ||
| 91 | -PNCircleChart * circleChart = [[PNCircleChart alloc] initWithFrame:CGRectMake(0, 80.0, SCREEN_WIDTH, 100.0) andTotal:[NSNumber numberWithInt:100] andCurrent:[NSNumber numberWithInt:60] andClockwise:NO]; | 91 | +PNCircleChart * circleChart = [[PNCircleChart alloc] initWithFrame:CGRectMake(0, 80.0, SCREEN_WIDTH, 100.0) total:[NSNumber numberWithInt:100] current:[NSNumber numberWithInt:60] clockwise:NO shadow:NO]; |
| 92 | circleChart.backgroundColor = [UIColor clearColor]; | 92 | circleChart.backgroundColor = [UIColor clearColor]; |
| 93 | [circleChart setStrokeColor:PNGreen]; | 93 | [circleChart setStrokeColor:PNGreen]; |
| 94 | [circleChart strokeChart]; | 94 | [circleChart strokeChart]; |
-
Please register or login to post a comment