Showing
6 changed files
with
10 additions
and
204 deletions
| @@ -21,7 +21,6 @@ | @@ -21,7 +21,6 @@ | ||
| 21 | 0AF7A889182AA9F6003645C4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AF7A86B182AA9F6003645C4 /* UIKit.framework */; }; | 21 | 0AF7A889182AA9F6003645C4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AF7A86B182AA9F6003645C4 /* UIKit.framework */; }; |
| 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 | - 0AF7A8A1182AAAAA003645C4 /* PNChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8A0182AAAAA003645C4 /* PNChart.m */; }; | ||
| 25 | 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */; }; | 24 | 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */; }; |
| 26 | 0AF7A8B3182AC604003645C4 /* PNLineChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8B2182AC604003645C4 /* PNLineChart.m */; }; | 25 | 0AF7A8B3182AC604003645C4 /* PNLineChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8B2182AC604003645C4 /* PNLineChart.m */; }; |
| 27 | 0AF7A8B6182ADDEB003645C4 /* PNBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8B5182ADDEB003645C4 /* PNBarChart.m */; }; | 26 | 0AF7A8B6182ADDEB003645C4 /* PNBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8B5182ADDEB003645C4 /* PNBarChart.m */; }; |
| @@ -63,7 +62,6 @@ | @@ -63,7 +62,6 @@ | ||
| 63 | 0AF7A890182AA9F6003645C4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; | 62 | 0AF7A890182AA9F6003645C4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; |
| 64 | 0AF7A892182AA9F6003645C4 /* PNChartDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PNChartDemoTests.m; sourceTree = "<group>"; }; | 63 | 0AF7A892182AA9F6003645C4 /* PNChartDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PNChartDemoTests.m; sourceTree = "<group>"; }; |
| 65 | 0AF7A89F182AAAAA003645C4 /* PNChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PNChart.h; path = PNChart/PNChart.h; sourceTree = "<group>"; }; | 64 | 0AF7A89F182AAAAA003645C4 /* PNChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PNChart.h; path = PNChart/PNChart.h; sourceTree = "<group>"; }; |
| 66 | - 0AF7A8A0182AAAAA003645C4 /* PNChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PNChart.m; path = PNChart/PNChart.m; sourceTree = "<group>"; }; | ||
| 67 | 0AF7A8AD182AAEEF003645C4 /* PCChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PCChartViewController.h; sourceTree = "<group>"; }; | 65 | 0AF7A8AD182AAEEF003645C4 /* PCChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PCChartViewController.h; sourceTree = "<group>"; }; |
| 68 | 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PCChartViewController.m; sourceTree = "<group>"; }; | 66 | 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PCChartViewController.m; sourceTree = "<group>"; }; |
| 69 | 0AF7A8B1182AC604003645C4 /* PNLineChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PNLineChart.h; path = PNChart/PNLineChart.h; sourceTree = "<group>"; }; | 67 | 0AF7A8B1182AC604003645C4 /* PNLineChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PNLineChart.h; path = PNChart/PNLineChart.h; sourceTree = "<group>"; }; |
| @@ -190,7 +188,6 @@ | @@ -190,7 +188,6 @@ | ||
| 190 | 9F656B49184A4B90002E5675 /* PNLineChart */, | 188 | 9F656B49184A4B90002E5675 /* PNLineChart */, |
| 191 | 9F656B4A184A4BAC002E5675 /* PNChartUI */, | 189 | 9F656B4A184A4BAC002E5675 /* PNChartUI */, |
| 192 | 0AF7A89F182AAAAA003645C4 /* PNChart.h */, | 190 | 0AF7A89F182AAAAA003645C4 /* PNChart.h */, |
| 193 | - 0AF7A8A0182AAAAA003645C4 /* PNChart.m */, | ||
| 194 | 9F656B48184A4B83002E5675 /* PNBarChart */, | 191 | 9F656B48184A4B83002E5675 /* PNBarChart */, |
| 195 | 9F656B4B184A4BC9002E5675 /* PNCircleChart */, | 192 | 9F656B4B184A4BC9002E5675 /* PNCircleChart */, |
| 196 | 9FE9CFB818581102005B8223 /* PNChartDelegate.h */, | 193 | 9FE9CFB818581102005B8223 /* PNChartDelegate.h */, |
| @@ -355,7 +352,6 @@ | @@ -355,7 +352,6 @@ | ||
| 355 | 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */, | 352 | 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */, |
| 356 | 0AF7A8BE182AEB99003645C4 /* PNChartLabel.m in Sources */, | 353 | 0AF7A8BE182AEB99003645C4 /* PNChartLabel.m in Sources */, |
| 357 | 0AF7A8B9182AEB80003645C4 /* PNBar.m in Sources */, | 354 | 0AF7A8B9182AEB80003645C4 /* PNBar.m in Sources */, |
| 358 | - 0AF7A8A1182AAAAA003645C4 /* PNChart.m in Sources */, | ||
| 359 | 0AF7A8B6182ADDEB003645C4 /* PNBarChart.m in Sources */, | 355 | 0AF7A8B6182ADDEB003645C4 /* PNBarChart.m in Sources */, |
| 360 | 0AF7A874182AA9F6003645C4 /* main.m in Sources */, | 356 | 0AF7A874182AA9F6003645C4 /* main.m in Sources */, |
| 361 | 0AF7A8B3182AC604003645C4 /* PNLineChart.m in Sources */, | 357 | 0AF7A8B3182AC604003645C4 /* PNLineChart.m in Sources */, |
| @@ -58,11 +58,12 @@ | @@ -58,11 +58,12 @@ | ||
| 58 | lineChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; | 58 | lineChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; |
| 59 | lineChartLabel.textAlignment = NSTextAlignmentCenter; | 59 | lineChartLabel.textAlignment = NSTextAlignmentCenter; |
| 60 | 60 | ||
| 61 | - PNChart * lineChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)]; | 61 | + PNLineChart * lineChart = [[PNLineChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)]; |
| 62 | lineChart.backgroundColor = [UIColor clearColor]; | 62 | lineChart.backgroundColor = [UIColor clearColor]; |
| 63 | [lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; | 63 | [lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; |
| 64 | [lineChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]]; | 64 | [lineChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]]; |
| 65 | [lineChart strokeChart]; | 65 | [lineChart strokeChart]; |
| 66 | + | ||
| 66 | lineChart.delegate = self; | 67 | lineChart.delegate = self; |
| 67 | 68 | ||
| 68 | [viewController.view addSubview:lineChartLabel]; | 69 | [viewController.view addSubview:lineChartLabel]; |
| @@ -80,9 +81,8 @@ | @@ -80,9 +81,8 @@ | ||
| 80 | barChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; | 81 | barChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; |
| 81 | barChartLabel.textAlignment = NSTextAlignmentCenter; | 82 | barChartLabel.textAlignment = NSTextAlignmentCenter; |
| 82 | 83 | ||
| 83 | - PNChart * barChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)]; | 84 | + PNBarChart * barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)]; |
| 84 | barChart.backgroundColor = [UIColor clearColor]; | 85 | barChart.backgroundColor = [UIColor clearColor]; |
| 85 | - barChart.type = PNBarType; | ||
| 86 | [barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; | 86 | [barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; |
| 87 | [barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]]; | 87 | [barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]]; |
| 88 | [barChart strokeChart]; | 88 | [barChart strokeChart]; |
| @@ -103,17 +103,15 @@ | @@ -103,17 +103,15 @@ | ||
| 103 | circleChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; | 103 | circleChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; |
| 104 | circleChartLabel.textAlignment = NSTextAlignmentCenter; | 104 | circleChartLabel.textAlignment = NSTextAlignmentCenter; |
| 105 | 105 | ||
| 106 | - PNChart * circleChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 100.0)]; | 106 | + PNCircleChart * circleChart = [[PNCircleChart alloc] initWithFrame:CGRectMake(0, 80.0, SCREEN_WIDTH, 100.0) andTotal:[NSNumber numberWithInt:100] andCurrent:[NSNumber numberWithInt:60]]; |
| 107 | circleChart.backgroundColor = [UIColor clearColor]; | 107 | circleChart.backgroundColor = [UIColor clearColor]; |
| 108 | - circleChart.type = PNCircleType; | 108 | + [circleChart setStrokeColor:PNGreen]; |
| 109 | - circleChart.total = [NSNumber numberWithInt:100]; | ||
| 110 | - circleChart.current = [NSNumber numberWithInt:60]; | ||
| 111 | [circleChart strokeChart]; | 109 | [circleChart strokeChart]; |
| 112 | 110 | ||
| 113 | [viewController.view addSubview:circleChartLabel]; | 111 | [viewController.view addSubview:circleChartLabel]; |
| 114 | [viewController.view addSubview:circleChart]; | 112 | [viewController.view addSubview:circleChart]; |
| 115 | - | ||
| 116 | viewController.title = @"Circle Chart"; | 113 | viewController.title = @"Circle Chart"; |
| 114 | + | ||
| 117 | } | 115 | } |
| 118 | 116 | ||
| 119 | } | 117 | } |
| @@ -14,94 +14,3 @@ | @@ -14,94 +14,3 @@ | ||
| 14 | #import "PNBarChart.h" | 14 | #import "PNBarChart.h" |
| 15 | #import "PNCircleChart.h" | 15 | #import "PNCircleChart.h" |
| 16 | #import "PNChartDelegate.h" | 16 | #import "PNChartDelegate.h" |
| 17 | - | ||
| 18 | -typedef enum { | ||
| 19 | - /** Solid line chart style */ | ||
| 20 | - PNLineType, | ||
| 21 | - /** Bar chart style with bar background color */ | ||
| 22 | - PNBarType, | ||
| 23 | - /** Circle chart */ | ||
| 24 | - PNCircleType | ||
| 25 | - | ||
| 26 | -} PNChartType; | ||
| 27 | - | ||
| 28 | - | ||
| 29 | -@interface PNChart : UIView<PNChartDelegate> | ||
| 30 | - | ||
| 31 | - | ||
| 32 | -/** | ||
| 33 | - * PNChart delegate. | ||
| 34 | - */ | ||
| 35 | - | ||
| 36 | -@property(nonatomic,retain) id<PNChartDelegate> delegate; | ||
| 37 | - | ||
| 38 | -/** | ||
| 39 | - * This method will call and troke the line in animation. | ||
| 40 | - */ | ||
| 41 | - | ||
| 42 | --(void)strokeChart; | ||
| 43 | - | ||
| 44 | -/** | ||
| 45 | - * X Labels will show on chart. | ||
| 46 | - * | ||
| 47 | - */ | ||
| 48 | - | ||
| 49 | -@property (strong, nonatomic) NSArray * xLabels; | ||
| 50 | - | ||
| 51 | -/** | ||
| 52 | - * Y value for X label, Chart will generate the Y label by it self. | ||
| 53 | - * | ||
| 54 | - */ | ||
| 55 | - | ||
| 56 | -@property (strong, nonatomic) NSArray * yValues; | ||
| 57 | - | ||
| 58 | -@property (strong, nonatomic) PNLineChart * lineChart; | ||
| 59 | - | ||
| 60 | -@property (strong, nonatomic) PNBarChart * barChart; | ||
| 61 | - | ||
| 62 | -@property (strong, nonatomic) PNCircleChart * circleChart; | ||
| 63 | - | ||
| 64 | -/** | ||
| 65 | - * PNChart chart type. The default is PNLineChart. | ||
| 66 | - * | ||
| 67 | - * @see PNChartType | ||
| 68 | - */ | ||
| 69 | - | ||
| 70 | -@property (assign) PNChartType type; | ||
| 71 | - | ||
| 72 | -/** | ||
| 73 | - * PNChart chart stroke color. The default is PNGreen. | ||
| 74 | - * | ||
| 75 | - */ | ||
| 76 | - | ||
| 77 | -@property (nonatomic, strong) UIColor * strokeColor; | ||
| 78 | - | ||
| 79 | -/** | ||
| 80 | - * PNChart bar chart background color. The default is PNLightGrey. | ||
| 81 | - * | ||
| 82 | - */ | ||
| 83 | - | ||
| 84 | -@property (nonatomic, strong) UIColor * barBackgroundColor; | ||
| 85 | - | ||
| 86 | -/** | ||
| 87 | - * PNChart circle chart total number. | ||
| 88 | - * | ||
| 89 | - */ | ||
| 90 | - | ||
| 91 | -@property (nonatomic, strong) NSNumber * total; | ||
| 92 | - | ||
| 93 | -/** | ||
| 94 | - * PNChart circle chart current number. | ||
| 95 | - * | ||
| 96 | - */ | ||
| 97 | -@property (nonatomic, strong) NSNumber * current; | ||
| 98 | - | ||
| 99 | -/** | ||
| 100 | - * PNChart if chart show labels. | ||
| 101 | - * | ||
| 102 | - */ | ||
| 103 | -@property (nonatomic) BOOL showLabel; | ||
| 104 | - | ||
| 105 | - | ||
| 106 | - | ||
| 107 | -@end |
PNChartDemo/PNChart/PNChart.m
deleted
100644 → 0
| 1 | -// | ||
| 2 | -// PNChart.m | ||
| 3 | -// PNChart | ||
| 4 | -// | ||
| 5 | -// Created by kevin on 10/3/13. | ||
| 6 | -// Copyright (c) 2013年 kevinzhow. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "PNChart.h" | ||
| 10 | - | ||
| 11 | -@implementation PNChart | ||
| 12 | - | ||
| 13 | -- (id)initWithFrame:(CGRect)frame | ||
| 14 | -{ | ||
| 15 | - self = [super initWithFrame:frame]; | ||
| 16 | - if (self) { | ||
| 17 | - // Initialization code | ||
| 18 | - self.backgroundColor = [UIColor whiteColor]; | ||
| 19 | - self.clipsToBounds = NO; | ||
| 20 | - self.type = PNLineType; | ||
| 21 | - _showLabel = YES; | ||
| 22 | - self.strokeColor = PNFreshGreen; | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - return self; | ||
| 26 | -} | ||
| 27 | - | ||
| 28 | --(void)setUpChart{ | ||
| 29 | - if (self.type == PNLineType) { | ||
| 30 | - _lineChart = [[PNLineChart alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; | ||
| 31 | - _lineChart.backgroundColor = [UIColor clearColor]; | ||
| 32 | - _lineChart.showLabel = _showLabel; | ||
| 33 | - [self addSubview:_lineChart]; | ||
| 34 | - [_lineChart setYValues:_yValues]; | ||
| 35 | - [_lineChart setXLabels:_xLabels]; | ||
| 36 | - [_lineChart setStrokeColor:_strokeColor]; | ||
| 37 | - [_lineChart strokeChart]; | ||
| 38 | - _lineChart.delegate = self; | ||
| 39 | - | ||
| 40 | - | ||
| 41 | - }else if (self.type == PNBarType) | ||
| 42 | - { | ||
| 43 | - _barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; | ||
| 44 | - _barChart.backgroundColor = [UIColor clearColor]; | ||
| 45 | - if (_barBackgroundColor) { | ||
| 46 | - _barChart.barBackgroundColor = _barBackgroundColor; | ||
| 47 | - } | ||
| 48 | - _barChart.showLabel = _showLabel; | ||
| 49 | - [self addSubview:_barChart]; | ||
| 50 | - [_barChart setYValues:_yValues]; | ||
| 51 | - [_barChart setXLabels:_xLabels]; | ||
| 52 | - [_barChart setStrokeColor:_strokeColor]; | ||
| 53 | - [_barChart strokeChart]; | ||
| 54 | - | ||
| 55 | - }else if (self.type == PNCircleType) | ||
| 56 | - { | ||
| 57 | - _circleChart = [[PNCircleChart alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height) andTotal:self.total andCurrent:self.current]; | ||
| 58 | - _circleChart.backgroundColor = [UIColor clearColor]; | ||
| 59 | - _circleChart.lineWidth = [NSNumber numberWithFloat:8.0]; | ||
| 60 | - [_circleChart setStrokeColor:_strokeColor]; | ||
| 61 | - [_circleChart strokeChart]; | ||
| 62 | - [self addSubview:_circleChart]; | ||
| 63 | - } | ||
| 64 | -} | ||
| 65 | - | ||
| 66 | - | ||
| 67 | - | ||
| 68 | --(void)strokeChart | ||
| 69 | -{ | ||
| 70 | - if (_lineChart) { | ||
| 71 | - | ||
| 72 | - [_lineChart strokeChart]; | ||
| 73 | - [_lineChart setStrokeColor:_strokeColor]; | ||
| 74 | - | ||
| 75 | - }else if (_barChart) | ||
| 76 | - { | ||
| 77 | - | ||
| 78 | - [_barChart strokeChart]; | ||
| 79 | - [_barChart setStrokeColor:_strokeColor]; | ||
| 80 | - | ||
| 81 | - }else if (_circleChart) | ||
| 82 | - { | ||
| 83 | - [_circleChart strokeChart]; | ||
| 84 | - [_circleChart setStrokeColor:_strokeColor]; | ||
| 85 | - }else{ | ||
| 86 | - [self setUpChart]; | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - | ||
| 90 | -} | ||
| 91 | - | ||
| 92 | --(void)userClickedOnLineKeyPoint:(CGPoint)point andPointIndex:(NSInteger)index{ | ||
| 93 | - [_delegate userClickedOnLineKeyPoint:point andPointIndex:index]; | ||
| 94 | -} | ||
| 95 | - | ||
| 96 | --(void)userClickedOnLinePoint:(CGPoint)point { | ||
| 97 | - [_delegate userClickedOnLinePoint:point]; | ||
| 98 | -} | ||
| 99 | - | ||
| 100 | -@end |
| @@ -19,7 +19,9 @@ | @@ -19,7 +19,9 @@ | ||
| 19 | if (self) { | 19 | if (self) { |
| 20 | _total = total; | 20 | _total = total; |
| 21 | _current = current; | 21 | _current = current; |
| 22 | + _strokeColor = PNFreshGreen; | ||
| 22 | 23 | ||
| 24 | + _lineWidth = [NSNumber numberWithFloat:8.0]; | ||
| 23 | UIBezierPath* circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.center.x,self.center.y) radius:self.frame.size.height*0.5 startAngle:DEGREES_TO_RADIANS(270) endAngle:DEGREES_TO_RADIANS(270.01) clockwise:NO]; | 25 | UIBezierPath* circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.center.x,self.center.y) radius:self.frame.size.height*0.5 startAngle:DEGREES_TO_RADIANS(270) endAngle:DEGREES_TO_RADIANS(270.01) clockwise:NO]; |
| 24 | 26 | ||
| 25 | _circle = [CAShapeLayer layer]; | 27 | _circle = [CAShapeLayer layer]; |
| @@ -39,7 +39,6 @@ | @@ -39,7 +39,6 @@ | ||
| 39 | -(void)setYValues:(NSArray *)yValues | 39 | -(void)setYValues:(NSArray *)yValues |
| 40 | { | 40 | { |
| 41 | _yValues = yValues; | 41 | _yValues = yValues; |
| 42 | - _xLabelWidth = (self.frame.size.width)/[_yValues count]; | ||
| 43 | 42 | ||
| 44 | float max = 0; | 43 | float max = 0; |
| 45 | for (NSString * valueString in yValues) { | 44 | for (NSString * valueString in yValues) { |
| @@ -94,6 +93,8 @@ | @@ -94,6 +93,8 @@ | ||
| 94 | label.text = labelText; | 93 | label.text = labelText; |
| 95 | [self addSubview:label]; | 94 | [self addSubview:label]; |
| 96 | } | 95 | } |
| 96 | + }else{ | ||
| 97 | + _xLabelWidth = (self.frame.size.width)/[xLabels count]; | ||
| 97 | } | 98 | } |
| 98 | 99 | ||
| 99 | } | 100 | } |
-
Please register or login to post a comment