hugo-

定制饼状图

Signed-off-by: hugo- <1004581900@qq.com>
... ... @@ -65,4 +65,7 @@
- (void)recompute;
- (CGFloat)startPercentageForItemAtIndex:(NSUInteger)index;
- (CGFloat)endPercentageForItemAtIndex:(NSUInteger)index;
@end
... ...
... ... @@ -26,10 +26,7 @@
- (UILabel *)descriptionLabelForItemAtIndex:(NSUInteger)index;
- (PNPieChartDataItem *)dataItemForIndex:(NSUInteger)index;
- (CGFloat)startPercentageForItemAtIndex:(NSUInteger)index;
- (CGFloat)endPercentageForItemAtIndex:(NSUInteger)index;
- (CGFloat)ratioForItemAtIndex:(NSUInteger)index;
- (CAShapeLayer *)newCircleLayerWithRadius:(CGFloat)radius
borderWidth:(CGFloat)borderWidth
fillColor:(UIColor *)fillColor
... ...
... ... @@ -22,4 +22,13 @@
@property (nonatomic) UIColor *color;
@property (nonatomic) NSString *textDescription;
//hehejingjing
@property (nonatomic)UIColor *titlePathColor;
@property (nonatomic)CGFloat titlePathWidth;
@property (nonatomic)UIColor *titleColor;
@property (nonatomic)UIFont *titleFont;
+ (instancetype)dataItemWithValue:(CGFloat)value
color:(UIColor*)color
description:(NSString *)description titlePathColor:(UIColor *)titlePathColor titlePathLineWidth:(CGFloat)lineWidth titleColor:(UIColor *)titleColor titleFont:(UIFont *)titleFont;
@end
... ...
... ... @@ -14,18 +14,34 @@
+ (instancetype)dataItemWithValue:(CGFloat)value
color:(UIColor*)color{
PNPieChartDataItem *item = [PNPieChartDataItem new];
item.value = value;
item.color = color;
return item;
PNPieChartDataItem *item = [PNPieChartDataItem new];
item.value = value;
item.color = color;
item.textDescription = @"";
item.titlePathColor = [UIColor blackColor];
item.titlePathWidth = 0.5;
item.titleColor = [UIColor blackColor];
item.titleFont = [UIFont systemFontOfSize:12];
return item;
}
+ (instancetype)dataItemWithValue:(CGFloat)value
color:(UIColor*)color
description:(NSString *)description {
PNPieChartDataItem *item = [PNPieChartDataItem dataItemWithValue:value color:color];
item.textDescription = description;
return item;
PNPieChartDataItem *item = [PNPieChartDataItem dataItemWithValue:value color:color];
item.textDescription = description;
return item;
}
+ (instancetype)dataItemWithValue:(CGFloat)value
color:(UIColor*)color
description:(NSString *)description titlePathColor:(UIColor *)titlePathColor titlePathLineWidth:(CGFloat)lineWidth titleColor:(UIColor *)titleColor titleFont:(UIFont *)titleFont {
PNPieChartDataItem *item = [self dataItemWithValue:value color:color description:description];
item.titlePathColor = titlePathColor;
item.titlePathWidth = lineWidth;
item.titleColor = titleColor;
item.titleFont = titleFont;
return item;
}
- (void)setValue:(CGFloat)value{
... ...