sample static method

List<DataPoint> sample(
  1. List<DataPoint> data,
  2. int threshold
)

Down-sample data to at most threshold points by keeping local min & max.

Each bucket contributes local extrema, then the result is compacted when needed so render budgets remain predictable.

Implementation

static List<DataPoint> sample(List<DataPoint> data, int threshold) {
  final finiteData = _finiteDataPoints(data);
  return _sampleFinite(finiteData, threshold);
}