tickIncrement function
Implementation
num tickIncrement(num start, num stop, int count) {
final double step = (stop - start) / count;
final int power = (math.log(step) / math.ln10).floor();
final num exp = math.pow(10, power);
final double error = step / exp;
if (power >= 0) {
if (error >= _e10) {
return 10 * exp;
} else if (error >= _e5) {
return 5 * exp;
} else if (error >= _e2) {
return 2 * exp;
} else {
return 1 * exp;
}
} else {
final num negExp = -math.pow(10, -power);
if (error >= _e10) {
return negExp / 10;
} else if (error >= _e5) {
return negExp / 5;
} else if (error >= _e2) {
return negExp / 2;
} else {
return negExp;
}
}
}