Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SHPieChartView/SHPieChartView/SHPieChartView.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ - (void)drawRect:(CGRect)rect
if(_chartBackgroundColor) {
CGMutablePathRef path = createArc(_center, _radius, ANGLE(0), ANGLE(360));
createAndFillArc(context, path, _chartBackgroundColor.CGColor);
CGPathRelease(path);
}

__block CGFloat startAngle = 0;
Expand All @@ -120,6 +121,7 @@ - (void)drawRect:(CGRect)rect

CGMutablePathRef path = createArc(_center, _radius, ANGLE(startAngle), ANGLE(endAngle));
createAndFillArc(context, path, color);
CGPathRelease(path);

startAngle += angleValue;
}];
Expand All @@ -128,6 +130,7 @@ - (void)drawRect:(CGRect)rect
if(_isConcentric && _concentricRadius > 0 && _concentricColor) {
CGMutablePathRef path = createArc(_center, _concentricRadius, ANGLE(0), ANGLE(360));
createAndFillArc(context, path, _concentricColor.CGColor);
CGPathRelease(path);
}
}

Expand Down
12 changes: 6 additions & 6 deletions SHPieChartView/SHRootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@ - (void)viewDidLoad
concentricPieChart.concentricRadius = 70;
concentricPieChart.concentricColor = UIColorFromRGB(0x54525C);

[concentricPieChart addAngleValue:0.40 andClolor:[UIColor redColor]];
[concentricPieChart addAngleValue:0.40 andColor:[UIColor redColor]];

[self.view addSubview:concentricPieChart];


SHPieChartView *normalPieChart = [[SHPieChartView alloc] initWithFrame:CGRectMake(10, 230, 150, 150)];

[normalPieChart addAngleValue:0.40 andClolor:[UIColor redColor]];
[normalPieChart addAngleValue:0.20 andClolor:[UIColor greenColor]];
[normalPieChart addAngleValue:0.30 andClolor:[UIColor blueColor]];
[normalPieChart addAngleValue:0.10 andClolor:[UIColor orangeColor]];
[normalPieChart addAngleValue:0.40 andColor:[UIColor redColor]];
[normalPieChart addAngleValue:0.20 andColor:[UIColor greenColor]];
[normalPieChart addAngleValue:0.30 andColor:[UIColor blueColor]];
[normalPieChart addAngleValue:0.10 andColor:[UIColor orangeColor]];

[self.view addSubview:normalPieChart];

SHPieChartView *halfChart = [[SHPieChartView alloc] initWithFrame:CGRectMake(10, 400, 100, 100)];
[halfChart addAngleValue:0.40 andClolor:UIColorFromRGB(0x3C60A3)];
[halfChart addAngleValue:0.40 andColor:UIColorFromRGB(0x3C60A3)];

[self.view addSubview:halfChart];

Expand Down