Nenu Adrian

getAxisMinMax - Determine these values automagically

I found it very useful to have this... especially for testing if not for production purposes.

Will need in the .h:
- (NSArray*) getAxisMinMax:(NSArray*)xValues;
@@ -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];