/** * Generic "find the value-axis extent among records whose category * position falls inside a visible window" helper. Used by Y Bar, * X Bar, Candlestick, and any future categorical-axis chart that * wants an auto-fit value axis on zoom. * * Takes a pre-extracted numeric tuple per record via the `extract` * callback instead of reading fields directly, so the same code path * handles both Bar's `{ catIdx, y0, y1, axis, seriesId }` shape and * Candlestick's `{ xCenter, low, high }` shape. * * TODO(perf): linear scan. Callers that order records by category * index could pre-sort once and binary-search the slice to reduce * this to O(log N + K_visible). Deferred until profiling shows the * scan in the hot path. */ export interface VisibleExtent { min: number; max: number; hasFit: boolean; } export interface VisibleExtentRecord { /** * Position on the categorical axis — compared to the visible window. */ cat: number; /** * Low bound of the value-axis extent for this record. */ lo: number; /** * High bound of the value-axis extent for this record. */ hi: number; /** * True to skip this record (hidden series / wrong axis / etc.). */ skip: boolean; } /** * Walk `items`, filter by `visCatMin <= cat <= visCatMax` (and the * caller-supplied `skip` flag), and return min/max over `lo`/`hi`. * * Returns `hasFit: false` when the window matches no records, so * callers can fall back to the base domain. * * Zero-range guard: if every visible record shares a single value * (flat run), pad by `±|value|` so the axis doesn't collapse to a * single pixel. */ export declare function computeVisibleExtent(items: readonly T[], visCatMin: number, visCatMax: number, extract: (item: T, out: VisibleExtentRecord) => void, out: VisibleExtent): VisibleExtent;