calculateLogNiceInterval method Null safety

num calculateLogNiceInterval(
  1. num delta
)

To get the axis interval for logarithmic axis

Implementation

num calculateLogNiceInterval(num delta) {
  final List<num> intervalDivisions = <num>[10, 5, 2, 1];
  final num actualDesiredIntervalCount =
      _calculateDesiredIntervalCount(_axisSize, this);
  num niceInterval = delta;
  final num minInterval =
      math.pow(10, _calculateLogBaseValue(niceInterval, 10).floor());
  for (int i = 0; i < intervalDivisions.length; i++) {
    final num interval = intervalDivisions[i];
    final num currentInterval = minInterval * interval;
    if (actualDesiredIntervalCount < (delta / currentInterval)) {
      break;
    }
    niceInterval = currentInterval;
  }
  return niceInterval;
}