import { CurrencyPipe } from '@angular/common'; import { DaysPipe } from '../../format/pipes/days.pipe'; import { NumberPipe } from '../../format/pipes/number.pipe'; import { PercentagePipe } from '../../format/pipes/percentage.pipe'; import { SmallCurrencyPipe } from '../../format/pipes/small-currency.pipe'; import { CalloutComponent } from '../../overlay/callout/callout.component'; import { ContainerScalingType, DonutSizingConfig, FullChartScaleValues, FullScalingConfig } from './chart-scaling'; export declare namespace Chart { export const defaultColorPalette: string[]; export function chart(config: Config, data: InputData, dimensions: Dimensions): RenderedChart; export const DEFAULT_FONT_SIZE = 12; export const WIDTH_PER_LETTER = 6.5; export function calculateColorIndices(data: NonFlowData): Map; export function getColor(item: DataY | SupplementaryDataY | undefined, colorIndices: Map, colors: readonly string[]): string; export type InputData = LabeledData | TimeseriesData | FlowData; export type ProcessData = LabeledData | TimeseriesData | ProcessedFlowData; export type NonFlowData = LabeledData | TimeseriesData; type BaseData = { ys: DataY[]; supplementaryYs?: SupplementaryDataY[]; }; export type Pattern = 'solid' | 'striped' | 'dots'; export type DataY = { label: string; colorToken?: string; hidden?: boolean; isSecondary?: boolean; pattern?: Pattern; showLegendItem?: boolean; clickable?: boolean; values: number[]; }; export type SupplementaryDataY = DataY & { supplementalIndex: number; }; export type FlowY = { steps: string[]; values: number[]; clickable?: boolean; }; export type LabeledData = BaseData & { type: 'labeled'; x: { label: string; isSecondary?: boolean; }[]; }; export type TimeseriesData = BaseData & { type: 'timeseries'; x: number[]; }; export type FlowData = { type: 'flow'; ys: FlowY[]; }; export type ProcessedFlowData = { type: 'flow-processed'; x: FlowBucket[]; }; type FlowBucket = { totalCount: number; subBuckets: FlowSubBucket[]; }; type FlowSubBucket = { id: string; count: number; connections: FlowConnection[]; }; type FlowConnection = { direction: 'forward' | 'backward'; start: string; end: string; count: number; }; export type FlowConnectionRender = Omit & { elementType: 'connection'; step: number; path: string; emphasize?: boolean; topLine: { x1: number; y1: number; x2: number; y2: number; }; bottomLine: { x1: number; y1: number; x2: number; y2: number; }; }; type DonutData = { label: string; hidden?: boolean; value: number; isSecondary?: boolean; }; type Dimensions = { width: number; height: number; }; export type ChartType = 'line' | 'area' | 'bar' | 'horizontal-bar' | 'donut' | 'waterfall' | 'funnel' | 'flow'; type BaseConfig = { type: ChartType; groupedTooltip: boolean; colors: string[]; allowLegendToggle: boolean; zeroStateMessage: string; sizingErrorStateMessage: string; valueType: ValueType; secondaryValueType?: ValueType; truncateLegend: boolean; dateFormat?: Interval; showDataLabels?: boolean; }; type DonutSubConfig = { size: 'xsmall' | 'small' | 'medium' | 'large'; displayValue: string; displayLabel?: string; scalingConfig?: DonutSizingConfig; }; type FlowSubConfig = { subtitleFormatString: string; subBucketsConfig: { bucketId: string; bucketName: string; color: string; isHighlighted?: boolean; }[]; connectionColor?: string; }; export type Config = BaseConfig & ({ type: 'line' | 'area' | 'waterfall' | 'funnel'; scalingConfig?: FullScalingConfig; } | { type: 'bar' | 'horizontal-bar'; groupingType: 'stacked' | 'clustered'; scalingConfig?: FullScalingConfig; } | { type: 'donut'; donutDisplayInfo: DonutSubConfig; } | { type: 'flow'; showDataLabels: true; flowConfig: FlowSubConfig; scalingConfig?: FullScalingConfig; }); export const defaultConfig: Config; export const defaultDonutConfig: Config; type GenericTick = { value: number; label: string; secondaryLabel?: string; }; type XTick = Omit & { x: number; }; type YTick = Omit & { y: number; }; type BasicRect = { elementType: 'rect'; rectType?: string; x: number; y: number; width: number; height: number; offset?: number; pattern?: Pattern; rounding?: 'top' | 'bottom' | 'all' | 'none'; nonDisplay?: boolean; }; type FlowRect = BasicRect & { rectType: 'flow'; id: string; bucketIndex: number; count: number; totalCount: number; colorOverride?: string; darken: boolean; deEmphasize: boolean; }; export type Rect = (BasicRect & { rectType?: undefined; }) | FlowRect; type Circle = { cx: number; cy: number; }; export type FlowHoverTarget = { hoverTarget: 'barTitle'; bucketIndex: number; barId: string; } | { hoverTarget: 'bar'; bucketIndex: number; barId: string; forDarken: boolean; } | { hoverTarget: 'connection'; startId: string; endId: string; startBucketIndex: number; }; export type FlowHoverReturn = { hoverType: 'flow'; tooltip: { anchor: DOMRect; subtitle: string; secondarySubtitle?: string; }; } & FlowHoverTarget; export type HoverReturn = { hoverType: 'standard'; xIndex: number; yIndex: number; visibleYIndex: number; isSuppValue?: boolean; suppYIndex?: number; x: number; ys: number[]; tooltip: { anchor: DOMRect; preferredPosition?: CalloutComponent.AnchoredPosition; date: string | null; metrics: { color: string; label: string; value: string; pattern?: Pattern; }[]; }; } | FlowHoverReturn | null; export type Hover = (pos: { rect: DOMRect; x: number; y: number; containerScrollX: number; containerScrollY: number; }) => HoverReturn; export type TooltipContext = { xIndex: number; yIndex: number; isSuppValue?: boolean; suppYIndex?: number; }; export type RenderedChart = { chartWidth: number; chartHeight: number; chartSizingValues: FullChartScaleValues; xTicks: XTick[]; yTicks: YTick[]; hover?: Hover; colors: string[]; lines: { pattern?: Pattern; line: string | null; }[]; circles: Circle[]; areas: { pattern?: Pattern; area: string | null; }[]; bars: Rect[][]; arcs: (string | null)[]; horizontalBars: { pattern?: Pattern; horizontalBar: string | null; x: number; y: number; }[][]; dataLabels: DataLabel[]; waterfallLines: { x1: number; x2: number; y1: number; y2: number; }[]; gradients: Rect[][]; flowConnections: FlowConnectionRender[]; horizontalContainerScale: ContainerScalingType; verticalContainerScale: ContainerScalingType; chartError: 'sizing' | 'config' | null; }; type BasicDataLabel = { elementType: 'dataLabel'; dataLabelType?: string; label: string; xPos: number; yPos: number; anchor: 'start' | 'middle' | 'end'; line?: { x1: number; y1: number; x2: number; y2: number; }; bold?: boolean; }; type FlowDataLabel = BasicDataLabel & { elementType: 'dataLabel'; dataLabelType: 'flow'; bucketIndex: number; barId: string; }; export type DataLabel = (BasicDataLabel & { dataLabelType?: undefined; }) | FlowDataLabel; type ValueType = 'count' | 'currency' | 'percentage' | 'days'; export function getPipes(valueType: ValueType): { pipe: NumberPipe; fullPipe: NumberPipe; } | { pipe: SmallCurrencyPipe; fullPipe: CurrencyPipe; } | { pipe: PercentagePipe; fullPipe: PercentagePipe; } | { pipe: DaysPipe; fullPipe: DaysPipe; }; const intervals: readonly ["year", "quarter", "month", "week", "day"]; export type Interval = (typeof intervals)[number]; export function formatedDate(dateFormat: Interval, date: Date): string; export function convertChartDataToDonutData(chartData: NonFlowData): DonutData[]; export function isBarType(type: Chart.ChartType): boolean; export {}; }