thresholdScott<T> function
Returns the number of bins according to
Scott’s normal reference rule;
the input values must be numbers.
Implementation
int thresholdScott<T>(Iterable<num?> values, num min, num max) {
final c = count(values), d = deviation(values) ?? 0;
return c != 0 && d != 0
? ((max - min) * pow(c, 1 / 3) / (3.49 * d)).ceil()
: 1;
}