thresholdSturges function Binning data

int thresholdSturges(
  1. Iterable<num?> values, [
  2. num? min,
  3. num? max
])

Returns the number of bins according to Sturges’ formula; the input values must be numbers.

Implementation

int thresholdSturges(Iterable<num?> values, [num? min, num? max]) {
  return math.max(1, (math.log(count(values)) / math.ln2).ceil() + 1);
}