GraphKit
GraphKit copied to clipboard
fix for the NaN exception on GKLineGraph
In the _positionYForLineValue method, the denominator ([self _maxValue] - [self _minValue]) may have 0 value. In this case, exception arise for NaN.
The fix should be:
int diff = ([self _maxValue] - [self _minValue]);
CGFloat scale;
if (diff > 0) {
scale = (value - [self _minValue]) / diff;
}else{
scale = 0;
}