Merge branch 'master' of github.com:kevinzhow/PNChart
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]; |
| @@ -471,7 +471,7 @@ | @@ -471,7 +471,7 @@ | ||
| 471 | 471 | ||
| 472 | // create point | 472 | // create point |
| 473 | CAShapeLayer *pointLayer = [CAShapeLayer layer]; | 473 | CAShapeLayer *pointLayer = [CAShapeLayer layer]; |
| 474 | - pointLayer.strokeColor = [chartData.color CGColor]; | 474 | + pointLayer.strokeColor = [[chartData.color colorWithAlphaComponent:chartData.alpha]CGColor]; |
| 475 | pointLayer.lineCap = kCALineCapRound; | 475 | pointLayer.lineCap = kCALineCapRound; |
| 476 | pointLayer.lineJoin = kCALineJoinBevel; | 476 | pointLayer.lineJoin = kCALineJoinBevel; |
| 477 | pointLayer.fillColor = nil; | 477 | 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 |
| @@ -35,6 +35,7 @@ | @@ -35,6 +35,7 @@ | ||
| 35 | NSArray * data01Array = @[@60.1, @160.1, @126.4, @262.2, @186.2, @127.2, @176.2]; | 35 | NSArray * data01Array = @[@60.1, @160.1, @126.4, @262.2, @186.2, @127.2, @176.2]; |
| 36 | PNLineChartData *data01 = [PNLineChartData new]; | 36 | PNLineChartData *data01 = [PNLineChartData new]; |
| 37 | data01.color = PNFreshGreen; | 37 | data01.color = PNFreshGreen; |
| 38 | + data01.alpha = 0.3f; | ||
| 38 | data01.itemCount = data01Array.count; | 39 | data01.itemCount = data01Array.count; |
| 39 | data01.inflexionPointStyle = PNLineChartPointStyleTriangle; | 40 | data01.inflexionPointStyle = PNLineChartPointStyleTriangle; |
| 40 | data01.getData = ^(NSUInteger index) { | 41 | data01.getData = ^(NSUInteger index) { |
| @@ -46,6 +47,7 @@ | @@ -46,6 +47,7 @@ | ||
| 46 | NSArray * data02Array = @[@20.1, @180.1, @26.4, @202.2, @126.2, @167.2, @276.2]; | 47 | NSArray * data02Array = @[@20.1, @180.1, @26.4, @202.2, @126.2, @167.2, @276.2]; |
| 47 | PNLineChartData *data02 = [PNLineChartData new]; | 48 | PNLineChartData *data02 = [PNLineChartData new]; |
| 48 | data02.color = PNTwitterColor; | 49 | data02.color = PNTwitterColor; |
| 50 | + data02.alpha = 0.5f; | ||
| 49 | data02.itemCount = data02Array.count; | 51 | data02.itemCount = data02Array.count; |
| 50 | data02.inflexionPointStyle = PNLineChartPointStyleSquare; | 52 | data02.inflexionPointStyle = PNLineChartPointStyleSquare; |
| 51 | data02.getData = ^(NSUInteger index) { | 53 | data02.getData = ^(NSUInteger index) { |
-
Please register or login to post a comment