import { type NormalisedTextOrSegments, type ResolvedTextAlign } from 'ag-charts-core'; import type { AgAxisLabelFormatterParams, AgBaseAxisLabelStyleOptions, AgTimeIntervalUnit, DateFormatterStyle, FormatterParams, VerticalAlign } from 'ag-charts-types'; import type { ChartAxisLabelFlipFlag } from '../chartAxis'; export type FormatterCacheKey = `${DateFormatterStyle}:${'year' | 'month' | 'day' | 'none'}`; export interface FormatterCache { type: string; mergedFormat: string | Record; unit: AgTimeIntervalUnit | undefined; formatter: ((value: any, fractionDigits?: number) => string) | undefined; } export type AxisLabelFormatterCache = Record; export declare function createAxisLabelFormatterCache(): AxisLabelFormatterCache; export declare function getAxisLabelSideFlag(mirrored: boolean): ChartAxisLabelFlipFlag; /** * Offsets of a tick label's near and far edges from its anchor, along the axis. `textAlign` * `undefined` means the axis's own computed alignment, which is measured centre-anchored and * without regard to rotation. */ export declare function getTickLabelEdgeOffsets(width: number, rotation: number, textAlign: ResolvedTextAlign | undefined): { leading: number; trailing: number; }; /** * Offset from a tick's position - the middle of its band - to the band edge a configured alignment * anchors against. A scale with no bands puts the tick at no band edge, so the anchor stays put. * * The alignment is in canvas space, so `'right'` is the band's larger coordinate whichever way the * scale's range runs - hence the magnitude of a bandwidth a descending range gives a sign to. */ export declare function getBandEdgeOffset(bandwidth: number, textAlign: ResolvedTextAlign | undefined): number; /** * Offset from a tick's position - the middle of its band - to the band edge a configured vertical * alignment anchors against. A scale with no bands puts the tick at no band edge, so the anchor * stays put. * * The alignment is in canvas space, so `'bottom'` is the band's larger coordinate whichever way the * scale's range runs - hence the magnitude of a bandwidth a descending range gives a sign to. */ export declare function getVerticalBandEdgeOffset(bandwidth: number, verticalAlign: VerticalAlign | undefined): number; /** * Vertical shift that takes a text box measured under `from` to where `to` would place it. Both * alignments anchor the same glyphs, so the box only slides along its own height. */ export declare function getVerticalAlignShift(height: number, from: VerticalAlign, to: VerticalAlign): number; export interface LabelExtent { x0: number; x1: number; y0: number; y1: number; } export interface LabelBox { x: number; y: number; width: number; height: number; } /** * Extent of a label's glyph box relative to its anchor, once the label's own rotation about that * anchor is applied. `box` must be the untransformed, anchor-positioned glyph box, so that the * node's own rotation is not folded in twice. */ export declare function getRotatedLabelExtent(box: LabelBox, anchorX: number, anchorY: number, rotation: number): LabelExtent; /** * Horizontal shift that takes a text box measured under `from` to where `to` would place it. Both * alignments anchor the same glyphs, so the box only slides along its own width. */ export declare function getTextAlignShift(width: number, from: ResolvedTextAlign, to: ResolvedTextAlign): number; export declare function formatAxisLabelValue(label: (Pick & { formatter?: AgAxisLabelFormatterParams extends never ? never : (params: AgAxisLabelFormatterParams) => NormalisedTextOrSegments | undefined; format?: string | Record; }) | undefined, cache: AxisLabelFormatterCache, callWithContext: (formatter: (params: AgAxisLabelFormatterParams) => NormalisedTextOrSegments | undefined, params: AgAxisLabelFormatterParams) => NormalisedTextOrSegments | undefined, params: FormatterParams, index: number, options?: { specifier?: string | Record; dateStyle: DateFormatterStyle | undefined; truncateDate: 'year' | 'month' | 'day' | undefined; depth?: number; }): NormalisedTextOrSegments | undefined;