niceTicks function

List<double> niceTicks(
  1. double start,
  2. double stop,
  3. int count
)

Adjusts ticks for nice round values.

Implementation

List<double> niceTicks(double start, double stop, int count) {
  final step = tickStep(start, stop, count);

  if (step > 0) {
    start = (start / step).floor() * step;
    stop = (stop / step).ceil() * step;
  } else if (step < 0) {
    start = (start * step).ceil() / step;
    stop = (stop * step).floor() / step;
  }

  return linearTicks(start, stop, count);
}