tickStep function

num tickStep(
  1. num start,
  2. num stop,
  3. num count
)

Implementation

num tickStep(num start, num stop, num count) {
  final num step0 = (stop - start).abs() / math.max(0, count);
  num step1 = math.pow(10, (math.log(step0) / math.ln10).floor());
  final num error = step0 / step1;

  if (error >= _e10) step1 *= 10;
  if (error >= _e5) step1 *= 5;
  if (error >= _e2) step1 *= 2;

  return stop < start ? -step1 : step1;
}