hugo-

定制饼状图

Signed-off-by: hugo- <1004581900@qq.com>
@@ -65,4 +65,7 @@ @@ -65,4 +65,7 @@
65 65
66 - (void)recompute; 66 - (void)recompute;
67 67
  68 +- (CGFloat)startPercentageForItemAtIndex:(NSUInteger)index;
  69 +- (CGFloat)endPercentageForItemAtIndex:(NSUInteger)index;
  70 +
68 @end 71 @end
@@ -26,10 +26,7 @@ @@ -26,10 +26,7 @@
26 26
27 - (UILabel *)descriptionLabelForItemAtIndex:(NSUInteger)index; 27 - (UILabel *)descriptionLabelForItemAtIndex:(NSUInteger)index;
28 - (PNPieChartDataItem *)dataItemForIndex:(NSUInteger)index; 28 - (PNPieChartDataItem *)dataItemForIndex:(NSUInteger)index;
29 -- (CGFloat)startPercentageForItemAtIndex:(NSUInteger)index;  
30 -- (CGFloat)endPercentageForItemAtIndex:(NSUInteger)index;  
31 - (CGFloat)ratioForItemAtIndex:(NSUInteger)index; 29 - (CGFloat)ratioForItemAtIndex:(NSUInteger)index;
32 -  
33 - (CAShapeLayer *)newCircleLayerWithRadius:(CGFloat)radius 30 - (CAShapeLayer *)newCircleLayerWithRadius:(CGFloat)radius
34 borderWidth:(CGFloat)borderWidth 31 borderWidth:(CGFloat)borderWidth
35 fillColor:(UIColor *)fillColor 32 fillColor:(UIColor *)fillColor
@@ -22,4 +22,13 @@ @@ -22,4 +22,13 @@
22 @property (nonatomic) UIColor *color; 22 @property (nonatomic) UIColor *color;
23 @property (nonatomic) NSString *textDescription; 23 @property (nonatomic) NSString *textDescription;
24 24
  25 +//hehejingjing
  26 +@property (nonatomic)UIColor *titlePathColor;
  27 +@property (nonatomic)CGFloat titlePathWidth;
  28 +@property (nonatomic)UIColor *titleColor;
  29 +@property (nonatomic)UIFont *titleFont;
  30 ++ (instancetype)dataItemWithValue:(CGFloat)value
  31 + color:(UIColor*)color
  32 + description:(NSString *)description titlePathColor:(UIColor *)titlePathColor titlePathLineWidth:(CGFloat)lineWidth titleColor:(UIColor *)titleColor titleFont:(UIFont *)titleFont;
  33 +
25 @end 34 @end
@@ -14,18 +14,34 @@ @@ -14,18 +14,34 @@
14 14
15 + (instancetype)dataItemWithValue:(CGFloat)value 15 + (instancetype)dataItemWithValue:(CGFloat)value
16 color:(UIColor*)color{ 16 color:(UIColor*)color{
17 - PNPieChartDataItem *item = [PNPieChartDataItem new]; 17 + PNPieChartDataItem *item = [PNPieChartDataItem new];
18 - item.value = value; 18 + item.value = value;
19 - item.color = color; 19 + item.color = color;
20 - return item; 20 + item.textDescription = @"";
  21 + item.titlePathColor = [UIColor blackColor];
  22 + item.titlePathWidth = 0.5;
  23 + item.titleColor = [UIColor blackColor];
  24 + item.titleFont = [UIFont systemFontOfSize:12];
  25 + return item;
21 } 26 }
22 27
23 + (instancetype)dataItemWithValue:(CGFloat)value 28 + (instancetype)dataItemWithValue:(CGFloat)value
24 color:(UIColor*)color 29 color:(UIColor*)color
25 description:(NSString *)description { 30 description:(NSString *)description {
26 - PNPieChartDataItem *item = [PNPieChartDataItem dataItemWithValue:value color:color]; 31 + PNPieChartDataItem *item = [PNPieChartDataItem dataItemWithValue:value color:color];
27 - item.textDescription = description; 32 + item.textDescription = description;
28 - return item; 33 + return item;
  34 +}
  35 +
  36 ++ (instancetype)dataItemWithValue:(CGFloat)value
  37 + color:(UIColor*)color
  38 + description:(NSString *)description titlePathColor:(UIColor *)titlePathColor titlePathLineWidth:(CGFloat)lineWidth titleColor:(UIColor *)titleColor titleFont:(UIFont *)titleFont {
  39 + PNPieChartDataItem *item = [self dataItemWithValue:value color:color description:description];
  40 + item.titlePathColor = titlePathColor;
  41 + item.titlePathWidth = lineWidth;
  42 + item.titleColor = titleColor;
  43 + item.titleFont = titleFont;
  44 + return item;
29 } 45 }
30 46
31 - (void)setValue:(CGFloat)value{ 47 - (void)setValue:(CGFloat)value{