Showing
1 changed file
with
11 additions
and
7 deletions
| @@ -238,7 +238,11 @@ | @@ -238,7 +238,11 @@ | ||
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | /* This is a small circle that refers to the chart data */ | 240 | /* This is a small circle that refers to the chart data */ |
| 241 | - CGFloat legendCircle = 10; | 241 | + CGFloat legendCircle = 16; |
| 242 | + | ||
| 243 | + CGFloat hSpacing = 0; | ||
| 244 | + | ||
| 245 | + CGFloat beforeLabel = legendCircle + hSpacing; | ||
| 242 | 246 | ||
| 243 | /* x and y are the coordinates of the starting point of each legend item */ | 247 | /* x and y are the coordinates of the starting point of each legend item */ |
| 244 | CGFloat x = 0; | 248 | CGFloat x = 0; |
| @@ -252,7 +256,7 @@ | @@ -252,7 +256,7 @@ | ||
| 252 | 256 | ||
| 253 | 257 | ||
| 254 | /* Determine the max width of each legend item */ | 258 | /* Determine the max width of each legend item */ |
| 255 | - CGFloat maxLabelWidth = self.legendStyle == PNLegendItemStyleStacked ? (mWidth - legendCircle) : (mWidth / [self.items count] - legendCircle); | 259 | + CGFloat maxLabelWidth = self.legendStyle == PNLegendItemStyleStacked ? (mWidth - beforeLabel) : (mWidth / [self.items count] - beforeLabel); |
| 256 | 260 | ||
| 257 | /* this is used when labels wrap text and the line | 261 | /* this is used when labels wrap text and the line |
| 258 | * should be in the middle of the first row */ | 262 | * should be in the middle of the first row */ |
| @@ -268,20 +272,20 @@ | @@ -268,20 +272,20 @@ | ||
| 268 | 272 | ||
| 269 | 273 | ||
| 270 | // Add inflexion type | 274 | // Add inflexion type |
| 271 | - [legendViews addObject:[self drawInflexion:legendCircle * .8 | 275 | + [legendViews addObject:[self drawInflexion:legendCircle * .6 |
| 272 | center:CGPointMake(x + legendCircle / 2, y + singleRowHeight / 2) | 276 | center:CGPointMake(x + legendCircle / 2, y + singleRowHeight / 2) |
| 273 | andColor:pdata.color]]; | 277 | andColor:pdata.color]]; |
| 274 | 278 | ||
| 275 | - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x + legendCircle, y, maxLabelWidth, labelsize.height)]; | 279 | + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x + beforeLabel, y, maxLabelWidth, labelsize.height)]; |
| 276 | label.text = pdata.textDescription; | 280 | label.text = pdata.textDescription; |
| 277 | label.font = [UIFont systemFontOfSize:self.legendFontSize]; | 281 | label.font = [UIFont systemFontOfSize:self.legendFontSize]; |
| 278 | label.lineBreakMode = NSLineBreakByWordWrapping; | 282 | label.lineBreakMode = NSLineBreakByWordWrapping; |
| 279 | label.numberOfLines = 0; | 283 | label.numberOfLines = 0; |
| 280 | - x += self.legendStyle == PNLegendItemStyleStacked ? 0 : labelsize.width + legendCircle; | 284 | + x += self.legendStyle == PNLegendItemStyleStacked ? 0 : labelsize.width + beforeLabel; |
| 281 | y += self.legendStyle == PNLegendItemStyleStacked ? labelsize.height : 0; | 285 | y += self.legendStyle == PNLegendItemStyleStacked ? labelsize.height : 0; |
| 282 | 286 | ||
| 283 | - totalWidth = self.legendStyle == PNLegendItemStyleStacked ? fmaxf(totalWidth, labelsize.width + legendCircle) : totalWidth + labelsize.width + legendCircle; | 287 | + totalWidth = self.legendStyle == PNLegendItemStyleStacked ? fmaxf(totalWidth, labelsize.width + beforeLabel) : totalWidth + labelsize.width + beforeLabel; |
| 284 | - totalHeight = self.legendStyle == PNLegendItemStyleStacked ? fmaxf(totalHeight, labelsize.height) : totalHeight + labelsize.height; | 288 | + totalHeight = self.legendStyle == PNLegendItemStyleSerial ? fmaxf(totalHeight, labelsize.height) : totalHeight + labelsize.height; |
| 285 | [legendViews addObject:label]; | 289 | [legendViews addObject:label]; |
| 286 | } | 290 | } |
| 287 | 291 |
-
Please register or login to post a comment