getValue method
Returns the value at the given quantile
(between 0 and 1).
Implementation
@override
double getValue(num quantile) {
if (quantile < 0.0 || quantile > 1.0) {
throw ArgumentError("$quantile is not in [0..1]");
}
if (_values.isEmpty) return 0.0;
final pos = quantile * (_values.length + 1);
if (pos < 1) return _values[0].toDouble();
if (pos >= _values.length) return _values[_values.length - 1].toDouble();
final lower = _values[pos.toInt() - 1];
final upper = _values[pos.toInt()];
return (lower + (pos - pos.floor()) * (upper - lower)).toDouble();
}