Kevin

Merge pull request #199 from makoni/master

- Fix for issue: https://github.com/kevinzhow/PNChart/issues/198
@@ -61,6 +61,10 @@ @@ -61,6 +61,10 @@
61 _showChartBorder = NO; 61 _showChartBorder = NO;
62 _yChartLabelWidth = 18; 62 _yChartLabelWidth = 18;
63 _rotateForXAxisText = false; 63 _rotateForXAxisText = false;
  64 +
  65 + yLabelFormatter = ^(CGFloat yValue){
  66 + return [NSString stringWithFormat:@"%1.f",yValue];
  67 + };
64 } 68 }
65 69
66 - (void)setYValues:(NSArray *)yValues 70 - (void)setYValues:(NSArray *)yValues
@@ -141,9 +145,10 @@ @@ -141,9 +145,10 @@
141 }else{ 145 }else{
142 _xChartLabels = [NSMutableArray new]; 146 _xChartLabels = [NSMutableArray new];
143 } 147 }
144 - 148 +
145 - if (_showLabel) { 149 + _xLabelWidth = (self.frame.size.width - _chartMargin * 2) / [xLabels count];
146 - _xLabelWidth = (self.frame.size.width - _chartMargin * 2) / [xLabels count]; 150 +
  151 + if (_showLabel) {
147 int labelAddCount = 0; 152 int labelAddCount = 0;
148 for (int index = 0; index < _xLabels.count; index++) { 153 for (int index = 0; index < _xLabels.count; index++) {
149 labelAddCount += 1; 154 labelAddCount += 1;
@@ -409,7 +409,7 @@ @@ -409,7 +409,7 @@
409 if (!(_yValueMax - _yValueMin)) { 409 if (!(_yValueMax - _yValueMin)) {
410 innerGrade = 0.5; 410 innerGrade = 0.5;
411 } else { 411 } else {
412 - innerGrade = (yValue - _yValueMin) / (_yValueMax - _yValueMin) == 0 ? 0.5 : (yValue - _yValueMin) / (_yValueMax - _yValueMin); 412 + innerGrade = (yValue - _yValueMin) / (_yValueMax - _yValueMin);
413 } 413 }
414 414
415 CGFloat offSetX = (_chartCavanWidth) / (chartData.itemCount); 415 CGFloat offSetX = (_chartCavanWidth) / (chartData.itemCount);