/** One category measured at two points, with its change between them. */ export interface SlopeRow { id: string; label: string; from: number | null; to: number | null; /** `to − from`, or null when either end is missing. */ change: number | null; /** * Fractional change against a positive starting value, e.g. 0.12 for +12%. Null when either * end is missing or the start is zero or negative, where a percentage has no honest meaning. */ ratio: number | null; } /** `change` puts the largest gain first, `to` the largest end value, `input` keeps your order. */ export type SlopeOrder = 'change' | 'to' | 'input'; /** The change between two measurements under the positive-baseline percentage policy. */ export declare function changeBetween(from: number | null, to: number | null): { change: null; ratio: null; } | { change: number; ratio: number | null; }; export declare function slopeRows(data: readonly Row[], category: string, from: string, to: string, order?: SlopeOrder): SlopeRow[]; /** * One number for each end: the `sum` (default) or `mean` of the categories. `to` covers every * observed later value; the change compares only categories measured at both ends, so a category * that is new or has not reported yet never reads as growth or loss. */ export declare function slopeTotals(rows: readonly SlopeRow[], aggregate?: 'sum' | 'mean'): { change: null; ratio: null; to: number | null; } | { change: number; ratio: number | null; to: number | null; }; /** A value domain around both ends with a little headroom, so no dot touches an edge. */ export declare function slopeDomain(rows: readonly SlopeRow[]): readonly [number, number]; /** * Move label positions apart until neighbours are at least `gap` apart, staying within * [min, max] and as close to their targets as possible. Returns positions in input order. */ export declare function spreadLabels(targets: readonly number[], gap: number, min: number, max: number): number[];