UNPKG

ag-charts-community

Version:

Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue

35 lines (34 loc) 1.76 kB
import { ScaleAlignment, type ScaleTickParams } from 'ag-charts-core'; import type { AgTimeInterval, AgTimeIntervalUnit } from 'ag-charts-types'; import { BandScale } from './bandScale'; /** Result of uniformity check via sampling */ export interface UniformityCheck { isUniform: boolean; interval?: number; } export declare const APPROXIMATE_THRESHOLD = 1000; /** * Detect uniformity by sampling points from a range within the domain. * Returns interval if data is uniformly spaced (within 1% tolerance). */ export declare function checkUniformityBySampling(bands: readonly Date[], startIdx?: number, endIdx?: number): UniformityCheck; export declare abstract class DiscreteTimeScale extends BandScale<Date, AgTimeInterval | AgTimeIntervalUnit | number> { static is(value: unknown): value is DiscreteTimeScale; abstract ticks(params: ScaleTickParams<AgTimeInterval | AgTimeIntervalUnit | number>, domain?: Date[], visibleRange?: [number, number]): { ticks: Date[]; count: number | undefined; firstTickIndex?: number; } | undefined; toDomain(value: number): Date; protected get reversed(): boolean; /** Cached numeric band values for efficient binary search. Subclasses should override with a cached version. */ protected get numericBands(): number[]; convert(value: Date, options?: { clamp?: boolean; alignment?: ScaleAlignment; }): number; invert(position: number, nearest?: boolean): Date | undefined; /** Override in subclass to provide cached uniformity check result */ getUniformityCache(_visibleRange?: [number, number]): UniformityCheck | undefined; findIndex(value: Date, alignment?: ScaleAlignment, alignmentExclusive?: boolean): number | undefined; }