andi

Merge branch 'master1'

@@ -157,7 +157,7 @@ displayCountingLabel:(BOOL)displayCountingLabel @@ -157,7 +157,7 @@ displayCountingLabel:(BOOL)displayCountingLabel
157 [_circle addAnimation:pathAnimation forKey:@"strokeEndAnimation"]; 157 [_circle addAnimation:pathAnimation forKey:@"strokeEndAnimation"];
158 _circle.strokeEnd = [_current floatValue] / [_total floatValue]; 158 _circle.strokeEnd = [_current floatValue] / [_total floatValue];
159 159
160 - [_countingLabel countFrom:0 to:[_current floatValue] withDuration:self.duration]; 160 + [_countingLabel countFrom:0 to:[_current floatValue]/([_total floatValue]/100.0) withDuration:self.duration];
161 161
162 162
163 // Check if user wants to add a gradient from the start color to the bar color 163 // Check if user wants to add a gradient from the start color to the bar color
@@ -235,4 +235,4 @@ displayCountingLabel:(BOOL)displayCountingLabel @@ -235,4 +235,4 @@ displayCountingLabel:(BOOL)displayCountingLabel
235 _total = total; 235 _total = total;
236 } 236 }
237 237
238 -@end 238 +@end
@@ -104,6 +104,20 @@ @@ -104,6 +104,20 @@
104 } 104 }
105 } 105 }
106 106
  107 +- (CGFloat)computeEqualWidthForXLabels:(NSArray *)xLabels
  108 +{
  109 + CGFloat xLabelWidth;
  110 +
  111 + if (_showLabel) {
  112 + xLabelWidth = _chartCavanWidth / [xLabels count];
  113 + } else {
  114 + xLabelWidth = (self.frame.size.width) / [xLabels count];
  115 + }
  116 +
  117 + return xLabelWidth;
  118 +}
  119 +
  120 +
107 - (void)setXLabels:(NSArray *)xLabels 121 - (void)setXLabels:(NSArray *)xLabels
108 { 122 {
109 CGFloat xLabelWidth; 123 CGFloat xLabelWidth;
This diff is collapsed. Click to expand it.
@@ -27,4 +27,11 @@ @@ -27,4 +27,11 @@
27 return item; 27 return item;
28 } 28 }
29 29
  30 +- (void)setValue:(CGFloat)value{
  31 + NSAssert(value >= 0, @"value should >= 0");
  32 + if (value != _value){
  33 + _value = value;
  34 + }
  35 +}
  36 +
30 @end 37 @end
@@ -156,6 +156,24 @@ @@ -156,6 +156,24 @@
156 } 156 }
157 } 157 }
158 158
  159 +- (NSArray*) getAxisMinMax:(NSArray*)xValues
  160 +{
  161 + float min = [xValues[0] floatValue];
  162 + float max = [xValues[0] floatValue];
  163 + for (NSNumber *number in xValues)
  164 + {
  165 + if ([number floatValue] > max)
  166 + max = [number floatValue];
  167 +
  168 + if ([number floatValue] < min)
  169 + min = [number floatValue];
  170 + }
  171 + NSArray *result = @[[NSNumber numberWithFloat:min], [NSNumber numberWithFloat:max]];
  172 +
  173 +
  174 + return result;
  175 +}
  176 +
159 - (void)setAxisXLabel:(NSArray *)array { 177 - (void)setAxisXLabel:(NSArray *)array {
160 if(array.count == ++_AxisX_partNumber){ 178 if(array.count == ++_AxisX_partNumber){
161 [_axisX_labels removeAllObjects]; 179 [_axisX_labels removeAllObjects];