Showing
1 changed file
with
11 additions
and
4 deletions
| @@ -72,7 +72,7 @@ | @@ -72,7 +72,7 @@ | ||
| 72 | //make the _yLabelSum value dependant of the distinct values of yValues to avoid duplicates on yAxis | 72 | //make the _yLabelSum value dependant of the distinct values of yValues to avoid duplicates on yAxis |
| 73 | int yLabelsDifTotal = (int)[NSSet setWithArray:yValues].count; | 73 | int yLabelsDifTotal = (int)[NSSet setWithArray:yValues].count; |
| 74 | 74 | ||
| 75 | - // !!!: 调整Y坐标的显示值 | 75 | + // !!!: 生效Y轴坐标的最大值 |
| 76 | if (_yLabelSum==defaultYSum) { | 76 | if (_yLabelSum==defaultYSum) { |
| 77 | _yLabelSum = yLabelsDifTotal % 2 == 0 ? yLabelsDifTotal : yLabelsDifTotal + 1; | 77 | _yLabelSum = yLabelsDifTotal % 2 == 0 ? yLabelsDifTotal : yLabelsDifTotal + 1; |
| 78 | } | 78 | } |
| @@ -85,7 +85,7 @@ | @@ -85,7 +85,7 @@ | ||
| 85 | 85 | ||
| 86 | if (_yChartLabels) { | 86 | if (_yChartLabels) { |
| 87 | [self viewCleanupForCollection:_yChartLabels]; | 87 | [self viewCleanupForCollection:_yChartLabels]; |
| 88 | - }else{ | 88 | + } else { |
| 89 | _yLabels = [NSMutableArray new]; | 89 | _yLabels = [NSMutableArray new]; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| @@ -93,7 +93,15 @@ | @@ -93,7 +93,15 @@ | ||
| 93 | //Add y labels | 93 | //Add y labels |
| 94 | float yLabelSectionHeight = (self.frame.size.height - _chartMargin * 2 - kXLabelHeight) / _yLabelSum; | 94 | float yLabelSectionHeight = (self.frame.size.height - _chartMargin * 2 - kXLabelHeight) / _yLabelSum; |
| 95 | 95 | ||
| 96 | - // !!!: 用户自行修改Y轴坐标值 | 96 | + [self __addYCoordinateLabelsValuesWithyLabelSectionHeight:yLabelSectionHeight]; |
| 97 | + | ||
| 98 | + } | ||
| 99 | +} | ||
| 100 | + | ||
| 101 | +#pragma mark - Private Method | ||
| 102 | +#pragma mark - 添加柱状图的Y轴坐标 | ||
| 103 | +- (void)__addYCoordinateLabelsValuesWithyLabelSectionHeight:(float)yLabelSectionHeight{ | ||
| 104 | + | ||
| 97 | if (_yLabels) { | 105 | if (_yLabels) { |
| 98 | 106 | ||
| 99 | [self getYValueMax:_yLabels]; | 107 | [self getYValueMax:_yLabels]; |
| @@ -138,7 +146,6 @@ | @@ -138,7 +146,6 @@ | ||
| 138 | 146 | ||
| 139 | } | 147 | } |
| 140 | } | 148 | } |
| 141 | - } | ||
| 142 | } | 149 | } |
| 143 | 150 | ||
| 144 | -(void)updateChartData:(NSArray *)data{ | 151 | -(void)updateChartData:(NSArray *)data{ |
-
Please register or login to post a comment