kevinzhow / PNChart

A simple and beautiful chart lib used in Piner and CoinsMan for iOS
MIT License
9.71k stars 1.76k forks source link

PNPireChart画饼状图时添加间距 #447

Open Gusont opened 5 years ago

Gusont commented 5 years ago

CGFloat sinf = sin((endPercentage - startPercentage) M_PI + startPercentage M_PI 2 ) self.itemSpacing; CGFloat cosf = cos((endPercentage - startPercentage) M_PI + startPercentage M_PI 2) self.itemSpacing;

CGPoint center = CGPointMake(CGRectGetMidX(self.bounds) + sinf ,CGRectGetMidY(self.bounds) - cosf);

大意就是通过改变中心点的位置修改item的位置 default

Gusont commented 5 years ago

simulator screen shot - iphone xs max - 2018-10-11 at 16 26 50 simulator screen shot - iphone xs max - 2018-10-11 at 16 27 16