Kevin

Merge pull request #229 from thedazed/master

Add prefix/suffix public property for y label values
@@ -46,6 +46,12 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue); @@ -46,6 +46,12 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue);
46 /** Formats the ylabel text. */ 46 /** Formats the ylabel text. */
47 @property (copy) PNYLabelFormatter yLabelFormatter; 47 @property (copy) PNYLabelFormatter yLabelFormatter;
48 48
  49 +/** Prefix to y label values, none if unset. */
  50 +@property (nonatomic) NSString *yLabelPrefix;
  51 +
  52 +/** Suffix to y label values, none if unset. */
  53 +@property (nonatomic) NSString *yLabelSuffix;
  54 +
49 @property (nonatomic) CGFloat chartMargin; 55 @property (nonatomic) CGFloat chartMargin;
50 56
51 /** Controls whether labels should be displayed. */ 57 /** Controls whether labels should be displayed. */
@@ -119,7 +119,7 @@ @@ -119,7 +119,7 @@
119 label.font = _labelFont; 119 label.font = _labelFont;
120 label.textColor = _labelTextColor; 120 label.textColor = _labelTextColor;
121 [label setTextAlignment:NSTextAlignmentRight]; 121 [label setTextAlignment:NSTextAlignmentRight];
122 - label.text = labelText; 122 + label.text = [NSString stringWithFormat:@"%@%@%@", _yLabelPrefix, labelText, _yLabelSuffix];
123 [self addSubview:label]; 123 [self addSubview:label];
124 124
125 [_yChartLabels addObject:label]; 125 [_yChartLabels addObject:label];
@@ -38,6 +38,9 @@ @@ -38,6 +38,9 @@
38 /** Show absolute values not relative i.e. percentages */ 38 /** Show absolute values not relative i.e. percentages */
39 @property (nonatomic) BOOL showAbsoluteValues; 39 @property (nonatomic) BOOL showAbsoluteValues;
40 40
  41 +/** Default YES. */
  42 +@property (nonatomic) BOOL shouldHighlightSectorOnTouch;
  43 +
41 @property (nonatomic, weak) id<PNChartDelegate> delegate; 44 @property (nonatomic, weak) id<PNChartDelegate> delegate;
42 45
43 - (void)strokeChart; 46 - (void)strokeChart;
@@ -56,6 +56,7 @@ @@ -56,6 +56,7 @@
56 _descriptionTextShadowColor = [[UIColor blackColor] colorWithAlphaComponent:0.4]; 56 _descriptionTextShadowColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
57 _descriptionTextShadowOffset = CGSizeMake(0, 1); 57 _descriptionTextShadowOffset = CGSizeMake(0, 1);
58 _duration = 1.0; 58 _duration = 1.0;
  59 + _shouldHighlightSectorOnTouch = YES;
59 60
60 [super setupDefaultValues]; 61 [super setupDefaultValues];
61 [self loadDefault]; 62 [self loadDefault];
@@ -277,9 +278,12 @@ @@ -277,9 +278,12 @@
277 [self.delegate userClickedOnPieIndexItem:index]; 278 [self.delegate userClickedOnPieIndexItem:index];
278 } 279 }
279 280
  281 + if (self.shouldHighlightSectorOnTouch) {
  282 +
280 if (self.sectorHighlight) { 283 if (self.sectorHighlight) {
281 [self.sectorHighlight removeFromSuperlayer]; 284 [self.sectorHighlight removeFromSuperlayer];
282 } 285 }
  286 +
283 PNPieChartDataItem *currentItem = [self dataItemForIndex:index]; 287 PNPieChartDataItem *currentItem = [self dataItemForIndex:index];
284 288
285 CGFloat red,green,blue,alpha; 289 CGFloat red,green,blue,alpha;
@@ -297,6 +301,7 @@ @@ -297,6 +301,7 @@
297 startPercentage:startPercnetage 301 startPercentage:startPercnetage
298 endPercentage:endPercentage]; 302 endPercentage:endPercentage];
299 [_contentView.layer addSublayer:self.sectorHighlight]; 303 [_contentView.layer addSublayer:self.sectorHighlight];
  304 + }
300 } 305 }
301 306
302 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 307 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event