Merge pull request #134 from onevcat/feature/ib-support
Feature/ib support
Showing
5 changed files
with
41 additions
and
31 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 | { |
| @@ -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]; |
-
Please register or login to post a comment