linearTicks function
Generates tick values for a linear scale.
Implementation
List<double> linearTicks(double start, double stop, [int count = 10]) {
if (count <= 0) return [];
final reverse = stop < start;
if (reverse) {
final temp = start;
start = stop;
stop = temp;
}
final step = tickStep(start, stop, count);
if (step == 0 || !step.isFinite) return [];
final ticks = <double>[];
if (step > 0) {
final r0 = (start / step).ceil();
final r1 = (stop / step).floor();
final n = r1 - r0 + 1;
for (int i = 0; i < n; i++) {
ticks.add((r0 + i) * step);
}
} else {
final r0 = (start * step).floor();
final r1 = (stop * step).ceil();
final n = r0 - r1 + 1;
for (int i = 0; i < n; i++) {
ticks.add((r0 - i) / step);
}
}
return reverse ? ticks.reversed.toList() : ticks;
}