@tanstack/charts
Version:
A chart grammar for TypeScript and JavaScript. Marks consume your data directly, channels describe visual encodings, and the engine compiles them into a renderer-neutral keyed scene. TanStack's compact scales cover common numeric and categorical mappings.
13 lines (12 loc) • 373 B
JavaScript
function quantileSortedValues(values, probability) {
if (!values.length) return Number.NaN;
const position = (values.length - 1) * probability;
const lower = Math.floor(position);
const upper = Math.ceil(position);
const start = values[lower];
const end = values[upper];
return start + (end - start) * (position - lower);
}
export {
quantileSortedValues
};