kevinzhow

Circle Chart response to the View Height

@@ -102,7 +102,7 @@ @@ -102,7 +102,7 @@
102 circleChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; 102 circleChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0];
103 circleChartLabel.textAlignment = NSTextAlignmentCenter; 103 circleChartLabel.textAlignment = NSTextAlignmentCenter;
104 104
105 - PNChart * circleChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)]; 105 + PNChart * circleChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 100.0)];
106 circleChart.backgroundColor = [UIColor clearColor]; 106 circleChart.backgroundColor = [UIColor clearColor];
107 circleChart.type = PNCircleType; 107 circleChart.type = PNCircleType;
108 circleChart.total = [NSNumber numberWithInt:100]; 108 circleChart.total = [NSNumber numberWithInt:100];
@@ -20,9 +20,7 @@ @@ -20,9 +20,7 @@
20 _total = total; 20 _total = total;
21 _current = current; 21 _current = current;
22 22
23 - NSLog(@"Total is %f frame is %f",[total floatValue],frame.size.height); 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];
24 -  
25 - UIBezierPath* circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.center.x,self.center.y - 25.0) radius:50.0 startAngle:DEGREES_TO_RADIANS(270) endAngle:DEGREES_TO_RADIANS(270.01) clockwise:NO];  
26 24
27 _circle = [CAShapeLayer layer]; 25 _circle = [CAShapeLayer layer];
28 _circle.path = circlePath.CGPath; 26 _circle.path = circlePath.CGPath;
@@ -57,7 +55,7 @@ @@ -57,7 +55,7 @@
57 [gradeLabel setTextAlignment:NSTextAlignmentCenter]; 55 [gradeLabel setTextAlignment:NSTextAlignmentCenter];
58 [gradeLabel setFont:[UIFont boldSystemFontOfSize:13.0f]]; 56 [gradeLabel setFont:[UIFont boldSystemFontOfSize:13.0f]];
59 [gradeLabel setTextColor: PNDeepGrey]; 57 [gradeLabel setTextColor: PNDeepGrey];
60 - [gradeLabel setCenter:CGPointMake(self.center.x,self.center.y - 25.0)]; 58 + [gradeLabel setCenter:CGPointMake(self.center.x,self.center.y)];
61 gradeLabel.method = UILabelCountingMethodEaseInOut; 59 gradeLabel.method = UILabelCountingMethodEaseInOut;
62 gradeLabel.format = @"%d%%"; 60 gradeLabel.format = @"%d%%";
63 61