Showing
1 changed file
with
9 additions
and
6 deletions
| @@ -112,16 +112,17 @@ | @@ -112,16 +112,17 @@ | ||
| 112 | CGFloat firstValue = [[_yValues objectAtIndex:0] floatValue]; | 112 | CGFloat firstValue = [[_yValues objectAtIndex:0] floatValue]; |
| 113 | 113 | ||
| 114 | CGFloat xPosition = 0; | 114 | CGFloat xPosition = 0; |
| 115 | - CGFloat chartCavanHeight = self.frame.size.height - 40.0; | 115 | + CGFloat xLabelHeight = 20.0; |
| 116 | + CGFloat chartCavanHeight = self.frame.size.height - xLabelHeight*2; | ||
| 116 | if(_showLabel){ | 117 | if(_showLabel){ |
| 117 | - chartCavanHeight = self.frame.size.height - chartMargin * 2 - 40.0; | 118 | + chartCavanHeight = self.frame.size.height - chartMargin * 2 - xLabelHeight*2; |
| 118 | - xPosition = _xLabelWidth; | 119 | + xPosition = _xLabelWidth; |
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | float grade = (float)firstValue / (float)_yValueMax; | 122 | float grade = (float)firstValue / (float)_yValueMax; |
| 122 | 123 | ||
| 123 | 124 | ||
| 124 | - [progressline moveToPoint:CGPointMake( xPosition, chartCavanHeight - grade * chartCavanHeight + 20.0)]; | 125 | + [progressline moveToPoint:CGPointMake( xPosition, chartCavanHeight - grade * chartCavanHeight + xLabelHeight)]; |
| 125 | [progressline setLineWidth:3.0]; | 126 | [progressline setLineWidth:3.0]; |
| 126 | [progressline setLineCapStyle:kCGLineCapRound]; | 127 | [progressline setLineCapStyle:kCGLineCapRound]; |
| 127 | [progressline setLineJoinStyle:kCGLineJoinRound]; | 128 | [progressline setLineJoinStyle:kCGLineJoinRound]; |
| @@ -132,9 +133,11 @@ | @@ -132,9 +133,11 @@ | ||
| 132 | float grade = (float)value / (float)_yValueMax; | 133 | float grade = (float)value / (float)_yValueMax; |
| 133 | if (index != 0) { | 134 | if (index != 0) { |
| 134 | 135 | ||
| 135 | - [progressline addLineToPoint:CGPointMake(index * _xLabelWidth + 30.0+ _xLabelWidth /2.0, chartCavanHeight - grade * chartCavanHeight + 20.0)]; | ||
| 136 | - [progressline moveToPoint:CGPointMake(index * _xLabelWidth + 30.0 + _xLabelWidth /2.0, chartCavanHeight - grade * chartCavanHeight + 20.0 )]; | ||
| 137 | 136 | ||
| 137 | + CGPoint point = CGPointMake(index * _xLabelWidth + 30.0 + _xLabelWidth /2.0, chartCavanHeight - (grade * chartCavanHeight) + xLabelHeight); | ||
| 138 | + | ||
| 139 | + [progressline addLineToPoint:point]; | ||
| 140 | + [progressline moveToPoint:point]; | ||
| 138 | } | 141 | } |
| 139 | 142 | ||
| 140 | index += 1; | 143 | index += 1; |
-
Please register or login to post a comment