kevinzhow

Fix circle chart

... ... @@ -26,8 +26,7 @@ typedef NS_ENUM (NSUInteger, PNChartFormatType) {
- (id)initWithFrame:(CGRect)frame
total:(NSNumber *)total
current:(NSNumber *)current
clockwise:(BOOL)clockwise
shadow:(BOOL)hasBackgroundShadow;
clockwise:(BOOL)clockwise;
- (id)initWithFrame:(CGRect)frame
total:(NSNumber *)total
... ...
... ... @@ -13,14 +13,14 @@
@implementation PNCircleChart
- (id)initWithFrame:(CGRect)frame total:(NSNumber *)total current:(NSNumber *)current clockwise:(BOOL)clockwise shadow:(BOOL)hasBackgroundShadow {
- (id)initWithFrame:(CGRect)frame total:(NSNumber *)total current:(NSNumber *)current clockwise:(BOOL)clockwise {
return [self initWithFrame:frame
total:total
current:current
clockwise:clockwise
shadow:shadow
shadowColor:PNGreen
shadow:NO
shadowColor:[UIColor clearColor]
displayCountingLabel:YES
overrideLineWidth:@8.0f];
... ... @@ -77,7 +77,7 @@ displayCountingLabel:(BOOL)displayCountingLabel
_lineWidth = overrideLineWidth;
UIBezierPath *circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.bounds.size.width/2.0f, self.bounds.size.height/2.0f)
UIBezierPath *circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.frame.size.width/2.0f, self.frame.size.height/2.0f)
radius:(self.frame.size.height * 0.5) - ([_lineWidth floatValue]/2.0f)
startAngle:DEGREES_TO_RADIANS(startAngle)
endAngle:DEGREES_TO_RADIANS(endAngle)
... ... @@ -107,7 +107,7 @@ displayCountingLabel:(BOOL)displayCountingLabel
[_countingLabel setFont:[UIFont boldSystemFontOfSize:16.0f]];
[_countingLabel setTextColor:[UIColor grayColor]];
[_countingLabel setBackgroundColor:[UIColor clearColor]];
[_countingLabel setCenter:CGPointMake(self.center.x, self.center.y)];
[_countingLabel setCenter:CGPointMake(self.frame.size.width/2.0f, self.frame.size.height/2.0f)];
_countingLabel.method = UILabelCountingMethodEaseInOut;
if (_displayCountingLabel) {
[self addSubview:_countingLabel];
... ...
... ... @@ -92,13 +92,14 @@
self.titleLabel.text = @"Circle Chart";
self.circleChart = [[PNCircleChart alloc] initWithFrame:CGRectMake(0, 80.0, SCREEN_WIDTH, 100.0)
self.circleChart = [[PNCircleChart alloc] initWithFrame:CGRectMake(0,150.0, SCREEN_WIDTH, 100.0)
total:@100
current:@60
clockwise:YES
shadow:YES];
clockwise:YES];
self.circleChart.backgroundColor = [UIColor clearColor];
[self.circleChart setStrokeColor:PNGreen];
[self.circleChart setStrokeColor:[UIColor clearColor]];
[self.circleChart setStrokeColorGradientStart:[UIColor blueColor]];
[self.circleChart strokeChart];
... ...