Showing
4 changed files
with
6 additions
and
2 deletions
| @@ -262,7 +262,7 @@ | @@ -262,7 +262,7 @@ | ||
| 262 | UIGraphicsBeginImageContext(self.frame.size); | 262 | UIGraphicsBeginImageContext(self.frame.size); |
| 263 | // setup the color of the chart line | 263 | // setup the color of the chart line |
| 264 | if (chartData.color) { | 264 | if (chartData.color) { |
| 265 | - chartLine.strokeColor = [chartData.color CGColor]; | 265 | + chartLine.strokeColor = [[chartData.color colorWithAlphaComponent:chartData.alpha]CGColor]; |
| 266 | } else { | 266 | } else { |
| 267 | chartLine.strokeColor = [PNGreen CGColor]; | 267 | chartLine.strokeColor = [PNGreen CGColor]; |
| 268 | pointLayer.strokeColor = [PNGreen CGColor]; | 268 | pointLayer.strokeColor = [PNGreen CGColor]; |
| @@ -475,7 +475,7 @@ | @@ -475,7 +475,7 @@ | ||
| 475 | 475 | ||
| 476 | // create point | 476 | // create point |
| 477 | CAShapeLayer *pointLayer = [CAShapeLayer layer]; | 477 | CAShapeLayer *pointLayer = [CAShapeLayer layer]; |
| 478 | - pointLayer.strokeColor = [chartData.color CGColor]; | 478 | + pointLayer.strokeColor = [[chartData.color colorWithAlphaComponent:chartData.alpha]CGColor]; |
| 479 | pointLayer.lineCap = kCALineCapRound; | 479 | pointLayer.lineCap = kCALineCapRound; |
| 480 | pointLayer.lineJoin = kCALineJoinBevel; | 480 | pointLayer.lineJoin = kCALineJoinBevel; |
| 481 | pointLayer.fillColor = nil; | 481 | pointLayer.fillColor = nil; |
| @@ -19,6 +19,7 @@ typedef PNLineChartDataItem *(^LCLineChartDataGetter)(NSUInteger item); | @@ -19,6 +19,7 @@ typedef PNLineChartDataItem *(^LCLineChartDataGetter)(NSUInteger item); | ||
| 19 | @interface PNLineChartData : NSObject | 19 | @interface PNLineChartData : NSObject |
| 20 | 20 | ||
| 21 | @property (strong) UIColor *color; | 21 | @property (strong) UIColor *color; |
| 22 | +@property (nonatomic) CGFloat alpha; | ||
| 22 | @property NSUInteger itemCount; | 23 | @property NSUInteger itemCount; |
| 23 | @property (copy) LCLineChartDataGetter getData; | 24 | @property (copy) LCLineChartDataGetter getData; |
| 24 | 25 |
| @@ -34,6 +34,7 @@ | @@ -34,6 +34,7 @@ | ||
| 34 | NSArray * data01Array = @[@60.1, @160.1, @126.4, @262.2, @186.2, @127.2, @176.2]; | 34 | NSArray * data01Array = @[@60.1, @160.1, @126.4, @262.2, @186.2, @127.2, @176.2]; |
| 35 | PNLineChartData *data01 = [PNLineChartData new]; | 35 | PNLineChartData *data01 = [PNLineChartData new]; |
| 36 | data01.color = PNFreshGreen; | 36 | data01.color = PNFreshGreen; |
| 37 | + data01.alpha = 0.3f; | ||
| 37 | data01.itemCount = data01Array.count; | 38 | data01.itemCount = data01Array.count; |
| 38 | data01.inflexionPointStyle = PNLineChartPointStyleTriangle; | 39 | data01.inflexionPointStyle = PNLineChartPointStyleTriangle; |
| 39 | data01.getData = ^(NSUInteger index) { | 40 | data01.getData = ^(NSUInteger index) { |
| @@ -45,6 +46,7 @@ | @@ -45,6 +46,7 @@ | ||
| 45 | NSArray * data02Array = @[@20.1, @180.1, @26.4, @202.2, @126.2, @167.2, @276.2]; | 46 | NSArray * data02Array = @[@20.1, @180.1, @26.4, @202.2, @126.2, @167.2, @276.2]; |
| 46 | PNLineChartData *data02 = [PNLineChartData new]; | 47 | PNLineChartData *data02 = [PNLineChartData new]; |
| 47 | data02.color = PNTwitterColor; | 48 | data02.color = PNTwitterColor; |
| 49 | + data02.alpha = 0.5f; | ||
| 48 | data02.itemCount = data02Array.count; | 50 | data02.itemCount = data02Array.count; |
| 49 | data02.inflexionPointStyle = PNLineChartPointStyleSquare; | 51 | data02.inflexionPointStyle = PNLineChartPointStyleSquare; |
| 50 | data02.getData = ^(NSUInteger index) { | 52 | data02.getData = ^(NSUInteger index) { |
-
Please register or login to post a comment