From 3d5308d2b32507f1e431169b53166a289275b88e Mon Sep 17 00:00:00 2001 From: lichen <1362906955@qq.com> Date: Mon, 22 Aug 2016 10:16:34 +0800 Subject: [PATCH] =?UTF-8?q?PNLineChart=E6=B7=BB=E5=8A=A0pointLabel?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E9=A2=9C=E8=89=B2=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PNChart/PNLineChart.m | 2 +- PNChart/PNLineChartData.h | 1 + PNChart/PNLineChartData.m | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/PNChart/PNLineChart.m b/PNChart/PNLineChart.m index 0e4349a4..c57ff80b 100755 --- a/PNChart/PNLineChart.m +++ b/PNChart/PNLineChart.m @@ -1030,7 +1030,7 @@ - (CATextLayer *)createPointLabelFor:(CGFloat)grade pointCenter:(CGPoint)pointCe CATextLayer *textLayer = [[CATextLayer alloc] init]; [textLayer setAlignmentMode:kCAAlignmentCenter]; [textLayer setForegroundColor:[chartData.pointLabelColor CGColor]]; - [textLayer setBackgroundColor:[[[UIColor whiteColor] colorWithAlphaComponent:0.8] CGColor]]; + [textLayer setBackgroundColor:[chartData.pointLabelBackgroundColor CGColor]]; [textLayer setCornerRadius:textLayer.fontSize / 8.0]; if (chartData.pointLabelFont != nil) { diff --git a/PNChart/PNLineChartData.h b/PNChart/PNLineChartData.h index fc85a564..4cfed708 100755 --- a/PNChart/PNLineChartData.h +++ b/PNChart/PNLineChartData.h @@ -27,6 +27,7 @@ typedef PNLineChartDataItem *(^LCLineChartDataGetter)(NSUInteger item); @property (nonatomic) BOOL showPointLabel; @property (nonatomic) UIColor *pointLabelColor; +@property(nonatomic,retain) UIColor* pointLabelBackgroundColor; @property (nonatomic) UIFont *pointLabelFont; @property (nonatomic) NSString *pointLabelFormat; diff --git a/PNChart/PNLineChartData.m b/PNChart/PNLineChartData.m index 6b697c71..f6aa8af7 100755 --- a/PNChart/PNLineChartData.m +++ b/PNChart/PNLineChartData.m @@ -25,6 +25,7 @@ - (void)setupDefaultValues _alpha = 1.f; _showPointLabel = NO; _pointLabelColor = [UIColor blackColor]; + _pointLabelBackgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8]; _pointLabelFormat = @"%1.f"; }