UNPKG

ag-charts-community

Version:

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

21 lines (20 loc) 1.55 kB
import type { AgAxisLabelFormatterParams, AgBaseAxisLabelStyleOptions, AgTimeIntervalUnit, DateFormatterStyle, FormatterParams, TextOrSegments } 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<string, string>; unit: AgTimeIntervalUnit | undefined; formatter: ((value: any, fractionDigits?: number) => string) | undefined; } export type AxisLabelFormatterCache = Record<FormatterCacheKey, FormatterCache | undefined>; export declare function createAxisLabelFormatterCache(): AxisLabelFormatterCache; export declare function getAxisLabelSideFlag(mirrored: boolean): ChartAxisLabelFlipFlag; export declare function formatAxisLabelValue(label: (Pick<AgBaseAxisLabelStyleOptions, never> & { formatter?: AgAxisLabelFormatterParams extends never ? never : ((params: AgAxisLabelFormatterParams) => TextOrSegments | undefined) | undefined; format?: string | Record<string, string>; }) | undefined, cache: AxisLabelFormatterCache, callWithContext: (formatter: (params: AgAxisLabelFormatterParams) => TextOrSegments | undefined, params: AgAxisLabelFormatterParams) => TextOrSegments | undefined, params: FormatterParams<any>, index: number, options?: { specifier?: string | Record<string, string>; dateStyle: DateFormatterStyle; truncateDate: 'year' | 'month' | 'day' | undefined; }): TextOrSegments | undefined;