@pond-ts/charts API Reference
    Preparing search index...

    Interface TradingTimeScale

    A d3-scale-shaped time scale whose pixel mapping runs through trading time — closed-market gaps (weekends, holidays, overnight, lunch breaks) collapse to nothing while time stays proportional within each session. Exposes the slice of the d3 ScaleTime surface @pond-ts/charts actually uses, so it drops in wherever the container's xScale goes.

    Ticks are calendar-aware when the provider enumerates its gaps: .ticks walks the logical ladder (hour1 → hour3 → hour6 → hour12 → day → week → month → quarter → year) and returns the finest rung that fits count, and .tickFormat labels each anchor at that grain (%H:%M for hours, %b %d for days/weeks, %b for months/quarters, %Y for years) while formatting any other instant (the cursor readout) with the d3 multi-scale default. The coarser context a label drops lives on .tickBoundaries — the second-row boundary labels (the date over a clock axis, the year over a day / week / month axis), one per boundary crossing plus the first tick. Without a provider boundaries method it falls back to interior even-spaced time ticks.

    Out-of-domain behavior. Within the calendar the scale extrapolates like a normal scale — a live instant before the domain start maps to a negative pixel (so off-plot marks are still culled). Instants outside the calendar entirely (before the first session / after the last) have no trading-time position and clamp to the near edge rather than extrapolating into meaningless space. In practice marks are always in-calendar, so this only affects data beyond the calendar's absolute extremes.

    interface TradingTimeScale {
        boundaryContext(count?: number): string | undefined;
        copy(): TradingTimeScale;
        domain(): [number, number];
        domain(next: readonly [number, number]): TradingTimeScale;
        invert(pixel: number): number;
        range(): [number, number];
        range(next: readonly [number, number]): TradingTimeScale;
        tickBoundaries(count?: number): (value: number) => string | undefined;
        tickFormat(count?: number, specifier?: string): (date: Date) => string;
        ticks(count?: number): number[];
        (value: number): number;
    }
    Index

    Methods

    • The boundary-row label for the domain start — the reader's left-edge context (Jan 01 over an intraday axis, the year over a month axis), rendered pinned at the plot's left edge. A property of the domain, not of any tick — so it stays put on a live sliding window instead of hopping from tick to tick. undefined when the grain has no boundary row.

      Parameters

      • Optionalcount: number

      Returns string | undefined

    • The second-row (boundary) label for a tick value, or undefined for ticks that don't open a new boundary period. Same grain selection as ticks at the same count, so the rows agree: each tick starting a new day / year (whichever is the next-coarser unit the first-row label omits) carries the label — a crossing. The left-edge context (what period the domain starts in) is boundaryContext, pinned by the axis rather than riding a tick; year-grain ticks have no second row.

      Parameters

      • Optionalcount: number

      Returns (value: number) => string | undefined

    • Parameters

      • Optionalcount: number
      • Optionalspecifier: string

      Returns (date: Date) => string

    • Parameters

      • Optionalcount: number

      Returns number[]