UNPKG

ag-charts-community

Version:

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

44 lines (43 loc) 2.87 kB
import { type RequireOptional } from 'ag-charts-core'; import type { AgChartLabelFormatterParams, AgChartLabelOptions, AgTimeInterval, AgTimeIntervalUnit, FontStyle, FontWeight, Formatter } from 'ag-charts-types'; import type { ContextFormatter } from '../module/axisContext'; import type { Matrix } from '../scene/matrix'; import type { PlacedLabelDatum } from '../scene/util/labelPlacement'; import { BaseProperties } from '../util/properties'; import { type TextMeasurer } from '../util/textMeasurer'; import type { ChartAxisLabel, ChartAxisLabelFlipFlag } from './chartAxis'; export declare class Label<TParams = never, TDatum = any> extends BaseProperties implements AgChartLabelOptions<TDatum, RequireOptional<TParams>> { enabled: boolean; color?: string; fontStyle?: FontStyle; fontWeight?: FontWeight; fontSize: number; fontFamily: string; formatter?: Formatter<AgChartLabelFormatterParams<TDatum> & RequireOptional<TParams>>; format?: string; private _cachedFormatter; formatValue(formatWithContext: ContextFormatter<AgChartLabelFormatterParams<TDatum> & RequireOptional<TParams>>, type: 'number' | 'date' | 'category', value: any, params: AgChartLabelFormatterParams<TDatum> & RequireOptional<TParams>): string | undefined; } export declare function calculateLabelRotation(rotation?: number, parallel?: boolean, regularFlipRotation?: number, parallelFlipRotation?: number): { configuredRotation: number; defaultRotation: number; parallelFlipFlag: ChartAxisLabelFlipFlag; regularFlipFlag: ChartAxisLabelFlipFlag; }; export declare function getLabelSpacing(minSpacing?: number, rotated?: boolean): number; export declare function getTextBaseline(parallel: boolean, labelRotation: number, sideFlag: ChartAxisLabelFlipFlag, parallelFlipFlag: ChartAxisLabelFlipFlag): CanvasTextBaseline; export declare function getTextAlign(parallel: boolean, labelRotation: number, labelAutoRotation: number, sideFlag: ChartAxisLabelFlipFlag, regularFlipFlag: ChartAxisLabelFlipFlag): CanvasTextAlign; export declare function labelSpecifier(format: ChartAxisLabel['format'] | undefined, timeInterval: AgTimeInterval | AgTimeIntervalUnit | undefined): string | undefined; export declare function timeIntervalMaxLabelSize(label: ChartAxisLabel, primaryLabel: ChartAxisLabel | undefined, domain: Date[], timeInterval: AgTimeInterval | AgTimeIntervalUnit, textMeasurer: TextMeasurer): { width: number; height: number; }; export declare function createLabelData(tickData: { tickLabel: string | undefined; translation: number; }[], labelX: number, labelMatrix: Matrix, textMeasurer: TextMeasurer): PlacedLabelDatum[]; export declare function createFixedLabelData({ width, height, spacing }: { width: number; height: number; spacing: number; }, labelX: number, labelMatrix: Matrix): PlacedLabelDatum[];