import { type BoxBounds, type ITextMeasurer, type NormalisedTextOrSegments, type ResolvedTextAlign, type Scale, ScaleAlignment, type ScaleTickParams } from 'ag-charts-core'; import type { AgTimeInterval, AgTimeIntervalUnit, DateFormatterStyle, VerticalAlign } from 'ag-charts-types'; import type { AxisPrimaryTickCount } from '../../util/secondaryAxisTicks'; import type { ChartAxisLabel, ChartAxisLabelFlipFlag } from '../chartAxis'; import type { TickInterval } from './axisTick'; import { NiceMode, type TickDatum } from './axisUtil'; export type AnyTimeInterval = AgTimeInterval | AgTimeIntervalUnit; export interface AxisIntervalOptions { step?: TickInterval; values?: any[]; minSpacing?: number; maxSpacing?: number; } export interface GenerateTicksOptions>, TDatum> { label: ChartAxisLabel; /** Whether labels render parallel to the axis line. Internal axis state — see I2. */ parallel?: boolean; scale: TScale; domain: TDatum[]; range: [number, number]; visibleRange: [number, number]; niceMode: NiceMode[]; reverse: boolean; primaryTickCount: AxisPrimaryTickCount | undefined; defaultTickMinSpacing: number; axisRotation: number; labelOffset: number; sideFlag: ChartAxisLabelFlipFlag; primaryLabel?: ChartAxisLabel; interval: AxisIntervalOptions | undefined; minimumTimeGranularity?: AgTimeIntervalUnit; sizeLimit?: number; isVertical?: boolean; inRange?: (value: number) => boolean; /** * A configured `label.verticalAlign`, replacing the computed baseline the labels would otherwise * hang from. Collision avoidance measures each label's box from that baseline, so on a vertical * axis - where the baseline acts along the axis - neighbours of differing height are checked * where they will actually render. */ labelBaseline?: VerticalAlign; /** * Per-label displacement, across the axis, that the band flush for a configured * `label.verticalAlign` will apply once the ticks are laid out. Collision avoidance runs before * that flush, so without this the labels it approved can still be moved into each other - see * `CartesianAxis.alignLabelBands`. Only supplied when a flush is actually configured, so an axis * that leaves the option unset pays nothing. */ labelBandOffsets?: (this: void, ticks: TickDatum[], rotation: number, textAlign: ResolvedTextAlign, textBaseline: VerticalAlign) => number[] | undefined; tickFormatter(this: void, domain: TDatum[], ticks: TDatum[], primary: boolean, fractionDigits: number | undefined, timeInterval: AnyTimeInterval | undefined, dateStyle: DateFormatterStyle): (value: any, index: number) => NormalisedTextOrSegments | undefined; } export interface TickData { niceDomain: D[]; tickDomain: D[]; rawTicks: D[]; rawTickCount: number | undefined; fractionDigits: number; ticks: TickDatum[]; timeInterval: AnyTimeInterval | undefined; rawFirstTickIndex: number; } export declare function axisLabelsOverlap(data: readonly BoxBounds[], padding?: number): boolean; export declare function ticksEqual(a: unknown[], b: unknown[]): boolean; export declare function ticksSpacing(ticks: TickDatum[]): number; export declare function formatTicks>, D>(options: GenerateTicksOptions, { niceDomain, rawTicks, rawFirstTickIndex, generatePrimaryTicks, primaryTicksIndices, alignment, fractionDigits, timeInterval, }: { niceDomain: D[]; rawTicks: any[]; rawFirstTickIndex: number | undefined; generatePrimaryTicks: boolean; primaryTicksIndices: Set | undefined; alignment: ScaleAlignment | undefined; fractionDigits: number; timeInterval: AnyTimeInterval | undefined; }): TickDatum[]; export declare function withTemporaryDomain>, D>(scale: S, temporaryDomain: D[], callback: () => void): void; export declare function getTimeIntervalTicks>, D>(scale: S, visibleRange: [number, number], tickCount: number, maxTickCount: number, tickParams: Readonly>, timeInterval: AnyTimeInterval, reverse: boolean, minimumTimeGranularity?: AgTimeIntervalUnit): { ticks: Date[]; primaryTicksIndices: Set | undefined; alignment: ScaleAlignment | undefined; } | undefined; export declare function timeIntervalMaxLabelSize(label: ChartAxisLabel, primaryLabel: ChartAxisLabel | undefined, domain: Date[], timeInterval: AgTimeInterval | AgTimeIntervalUnit, textMeasurer: ITextMeasurer): { width: number; height: number; }; export declare function getTextBaseline(parallel: boolean, labelRotation: number, sideFlag: ChartAxisLabelFlipFlag, parallelFlipFlag: ChartAxisLabelFlipFlag): VerticalAlign; export declare function getTextAlign(parallel: boolean, labelRotation: number, labelAutoRotation: number, sideFlag: ChartAxisLabelFlipFlag, regularFlipFlag: ChartAxisLabelFlipFlag): ResolvedTextAlign; export declare function calculateLabelRotation(rotation?: number, parallel?: boolean, axisRotation?: number): { configuredRotation: number; defaultRotation: number; parallelFlipFlag: ChartAxisLabelFlipFlag; regularFlipFlag: ChartAxisLabelFlipFlag; };