/** WHAT AN AXIS'S LABELS TAKE — see {@link axisLabelFit}. */ export interface AxisLabelFit { /** The closest two CENTRED labels may sit, centre to centre. */ min: number; /** How far an ANCHORED end label leans past its own position — half a label. */ lean: number; } /** * WHAT AN AXIS'S OWN LABELS NEED before two of them touch. * * A constant cannot answer it. 50px fits `Jan` and `Feb` and does not fit * `15 thg 9` (62px), so a month of daily buckets printed "15 thg16 thg 9" — * two labels the axis believed were a comfortable step apart. The labels are * KNOWN before any of them is dropped, so the distance is read off the widest * one the axis would print rather than guessed. * * `textWidthSm` measures at `sm` where an axis draws at `xs`: a rung is measured * and never derived, so this is the nearest measured rung and it is the LARGER * one — an over-estimate thins one label too many, and an under-estimate * overprints. * * TWO NUMBERS, because the ends are not centred. A middle label is centred on * its position, so two of them clear at one label plus a gutter. The first and * last are anchored ON the track's edge (`line_chart.css`'s `translateX(0)` / * `translateX(-100%)`), so each leans half a label inward at the pair it belongs * to. Folding the lean into one number for the whole axis is what thins a narrow * card to a single label; dropping it is what overprints the newest reading. */ export declare function axisLabelFit(labels: readonly string[], gutter?: number): AxisLabelFit; /** * How many positions the axis skips between printed labels — 1 when every label * fits, `count` when the track has room for only one. Exported because a SLOT * geometry needs it twice: once to pick the labels, and once to give a survivor * the width of the span its dropped neighbours vacated. Deriving it a second * time at the call site is how the two drift. * * The floor is ONE label, not two. Forcing a second onto a track that fits one * breaks this module's own rule — the two then land closer together than a label * is wide, which is the overlap the thinning exists to prevent — and it is the * narrow end that needs the rule most, because that is where a track can go to * zero or below. */ export declare function axisLabelStep(count: number, chartWidth: number, minLabelWidth?: number): number; /** * The positions to print, thinned to what the track fits. * * THE CONTRACT: the result is empty ONLY when there is nothing to label * (`count <= 0`). An axis that HAS positions always prints at least one of them * — the last, the one a reader looks up — however little room it has, so a card * too narrow to fit a second label shows one rather than none. * * Whether the track has been MEASURED yet is the caller's fact, not this * function's: a host with no layout pass reports 0 exactly as a 0px track does, * and only the caller knows which it is holding. It answers that itself (show * every label until measured) before asking here. Returning `[]` for both a * zero width and a zero count made one value mean two things, and the two call * sites duly read it two ways — the line chart as "not measured", the bar chart * as "kept nothing", which is how a narrow card came to erase its whole label * row. */ export declare function axisLabelIndices(count: number, chartWidth: number, minLabelWidth?: number, /** How far this axis's END labels lean past their own position * ({@link axisLabelFit}). Zero — a SLOT geometry, whose labels all sit the * same way — keeps the slot count; above zero the axis is a POINT one, whose * labels span the track by the GAPS between them. */ lean?: number): number[];