GraphKit icon indicating copy to clipboard operation
GraphKit copied to clipboard

fix for the NaN exception on GKLineGraph

Open Venkata-Maniteja opened this issue 7 years ago • 0 comments

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;
  }

Venkata-Maniteja avatar Apr 18 '17 14:04 Venkata-Maniteja