Merge pull request #248 from jerrygdm/HideValues-PieChart
Show only titles, not values nor percentage
Showing
2 changed files
with
9 additions
and
2 deletions
| @@ -58,6 +58,9 @@ | @@ -58,6 +58,9 @@ | ||
| 58 | /** Multiple selection */ | 58 | /** Multiple selection */ |
| 59 | @property (nonatomic, assign) BOOL enableMultipleSelection; | 59 | @property (nonatomic, assign) BOOL enableMultipleSelection; |
| 60 | 60 | ||
| 61 | +/** show only tiles, not values or percentage */ | ||
| 62 | +@property (nonatomic) BOOL hideValues; | ||
| 63 | + | ||
| 61 | - (void)strokeChart; | 64 | - (void)strokeChart; |
| 62 | 65 | ||
| 63 | - (void)recompute; | 66 | - (void)recompute; |
| @@ -57,6 +57,7 @@ | @@ -57,6 +57,7 @@ | ||
| 57 | _duration = 1.0; | 57 | _duration = 1.0; |
| 58 | _shouldHighlightSectorOnTouch = YES; | 58 | _shouldHighlightSectorOnTouch = YES; |
| 59 | _enableMultipleSelection = NO; | 59 | _enableMultipleSelection = NO; |
| 60 | + _hideValues = NO; | ||
| 60 | 61 | ||
| 61 | [super setupDefaultValues]; | 62 | [super setupDefaultValues]; |
| 62 | [self loadDefault]; | 63 | [self loadDefault]; |
| @@ -138,6 +139,7 @@ | @@ -138,6 +139,7 @@ | ||
| 138 | 139 | ||
| 139 | UILabel *descriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 80)]; | 140 | UILabel *descriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 80)]; |
| 140 | NSString *titleText = currentDataItem.textDescription; | 141 | NSString *titleText = currentDataItem.textDescription; |
| 142 | + | ||
| 141 | NSString *titleValue; | 143 | NSString *titleValue; |
| 142 | 144 | ||
| 143 | if (self.showAbsoluteValues) { | 145 | if (self.showAbsoluteValues) { |
| @@ -145,9 +147,11 @@ | @@ -145,9 +147,11 @@ | ||
| 145 | }else{ | 147 | }else{ |
| 146 | titleValue = [NSString stringWithFormat:@"%.0f%%",[self ratioForItemAtIndex:index] * 100]; | 148 | titleValue = [NSString stringWithFormat:@"%.0f%%",[self ratioForItemAtIndex:index] * 100]; |
| 147 | } | 149 | } |
| 148 | - if(!titleText || self.showOnlyValues){ | 150 | + |
| 151 | + if (self.hideValues) | ||
| 152 | + descriptionLabel.text = titleText; | ||
| 153 | + else if(!titleText || self.showOnlyValues) | ||
| 149 | descriptionLabel.text = titleValue; | 154 | descriptionLabel.text = titleValue; |
| 150 | - } | ||
| 151 | else { | 155 | else { |
| 152 | NSString* str = [titleValue stringByAppendingString:[NSString stringWithFormat:@"\n%@",titleText]]; | 156 | NSString* str = [titleValue stringByAppendingString:[NSString stringWithFormat:@"\n%@",titleText]]; |
| 153 | descriptionLabel.text = str ; | 157 | descriptionLabel.text = str ; |
-
Please register or login to post a comment