UNPKG

ag-charts-enterprise

Version:

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

156 lines (155 loc) 7.98 kB
import type { AgWaterfallSeriesItemType, AgWaterfallSeriesOptions, AgWaterfallSeriesStyle } from 'ag-charts-community'; import { _ModuleSupport } from 'ag-charts-community'; import { ChartAxisDirection, type DomainWithMetadata, type DynamicContext, type NormalisedTextOrSegments, type Point } from 'ag-charts-core'; import type { AgNumericValue, SelectionState } from 'ag-charts-types'; import { WaterfallSeriesProperties } from './waterfallSeriesProperties'; type WaterfallNodeLabelDatum = Readonly<Point> & { readonly text: NormalisedTextOrSegments; readonly textAlign: CanvasTextAlign; readonly textBaseline: CanvasTextBaseline; }; type WaterfallNodePointDatum = _ModuleSupport.DataModelSeriesNodeDatum['point'] & { readonly x2: number; readonly y2: number; }; interface WaterfallNodeDatum extends _ModuleSupport.CartesianSeriesNodeDatum, Readonly<Point> { readonly index: number; readonly itemId?: string; readonly itemType: AgWaterfallSeriesItemType; readonly cumulativeValue: number; readonly width: number; readonly height: number; readonly label: WaterfallNodeLabelDatum; readonly crisp: boolean; readonly clipBBox?: _ModuleSupport.BBox; readonly opacity?: number; style?: Required<AgWaterfallSeriesStyle>; } interface WaterfallContext extends _ModuleSupport.AbstractBarSeriesNodeDataContext<WaterfallNodeDatum> { pointData?: WaterfallNodePointDatum[]; styles: Record<AgWaterfallSeriesItemType, _ModuleSupport.SeriesNodeStyleContext<Required<AgWaterfallSeriesStyle>>>; } /** Internal context for createNodeData() - caches expensive lookups */ interface WaterfallSeriesNodeDatumContext extends _ModuleSupport.CartesianCreateNodeDataContext<WaterfallNodeDatum> { readonly categoryAxis: _ModuleSupport.ChartAxis; readonly valueAxis: _ModuleSupport.ChartAxis; readonly barAlongX: boolean; readonly barWidth: number; readonly categoryAxisReversed: boolean; readonly valueAxisReversed: boolean; readonly crisp: boolean; readonly yKey: string; readonly yName: string | undefined; readonly lineStrokeWidth: number; readonly yDomain: number[]; readonly yRawValues: (AgNumericValue | undefined)[]; readonly totalTypeValues: (AgWaterfallSeriesItemType | undefined)[]; readonly yCurrValues: AgNumericValue[]; readonly yPrevValues: AgNumericValue[]; readonly yCurrTotalValues: AgNumericValue[]; pointData: WaterfallNodePointDatum[]; } /** * Consolidated type interface for WaterfallSeries. * Defines all type parameters in one place for the series. */ interface WaterfallSeriesTypes extends _ModuleSupport.AbstractBarSeriesTypes { readonly node: _ModuleSupport.Rect<WaterfallNodeDatum>; readonly options: AgWaterfallSeriesOptions; readonly properties: WaterfallSeriesProperties; readonly datum: WaterfallNodeDatum; readonly label: WaterfallNodeDatum; readonly context: WaterfallContext; readonly stackContext: never; readonly createNodeDataContext: WaterfallSeriesNodeDatumContext; } type WaterfallAnimationData = _ModuleSupport.AbstractBarSeriesAnimationData<WaterfallSeriesTypes>; declare class WaterfallSeriesNodeEvent<TEvent extends string = _ModuleSupport.SeriesNodeEventTypes> extends _ModuleSupport.CartesianSeriesNodeEvent<TEvent> { readonly itemType: AgWaterfallSeriesItemType; constructor(type: TEvent, nativeEvent: Event, datum: WaterfallNodeDatum, series: WaterfallSeries, selectionState: SelectionState | undefined); } export declare class WaterfallSeries extends _ModuleSupport.AbstractBarSeries<WaterfallSeriesTypes> { static readonly className = "WaterfallSeries"; static readonly type: "waterfall"; properties: WaterfallSeriesProperties; protected readonly NodeEvent: typeof WaterfallSeriesNodeEvent; constructor(moduleCtx: DynamicContext<_ModuleSupport.ChartRegistry>); private readonly seriesItemTypes; processData(dataController: _ModuleSupport.DataController): Promise<void>; getSeriesDomain(direction: ChartAxisDirection): DomainWithMetadata<any>; getSeriesRange(): [number, number]; protected populateNodeData(ctx: WaterfallSeriesNodeDatumContext): void; protected finalizeNodeData(ctx: WaterfallSeriesNodeDatumContext): void; protected initializeResult(ctx: WaterfallSeriesNodeDatumContext): WaterfallContext; protected assembleResult(ctx: WaterfallSeriesNodeDatumContext, result: WaterfallContext): WaterfallContext; protected createNodeDatumContext(xAxis: _ModuleSupport.ChartAxis, yAxis: _ModuleSupport.ChartAxis): WaterfallSeriesNodeDatumContext | undefined; private computeWaterfallValues; private computeDisplayValue; /** * Creates a skeleton WaterfallNodeDatum with minimal required fields. * The node will be populated by updateNodeDatum. */ private createSkeletonNodeDatum; /** * Updates an existing WaterfallNodeDatum in-place. * This is more efficient than recreating the entire node when only data values change. */ private updateNodeDatum; /** * Creates a WaterfallNodeDatum for a single data point. * Creates a skeleton node and uses updateNodeDatum to populate it. */ private createNodeDatum; private createPointDatum; private updateSeriesItemTypes; private isSubtotal; private isTotal; private getTotalValue; protected nodeFactory(): _ModuleSupport.Rect<WaterfallNodeDatum>; private getSeriesItemType; private getItemConfig; protected updateDatumSelection(opts: { nodeData: WaterfallNodeDatum[]; datumSelection: _ModuleSupport.Selection<WaterfallNodeDatum, _ModuleSupport.Rect<WaterfallNodeDatum>>; }): _ModuleSupport.Selection<WaterfallNodeDatum, _ModuleSupport.Rect<WaterfallNodeDatum>>; private getItemStyle; private makeItemStylerParams; protected updateDatumStyles({ datumSelection, isHighlight, }: { datumSelection: _ModuleSupport.Selection<WaterfallNodeDatum, _ModuleSupport.Rect<WaterfallNodeDatum>>; isHighlight: boolean; }): void; protected updateDatumNodes({ datumSelection, isHighlight, }: { datumSelection: _ModuleSupport.Selection<WaterfallNodeDatum, _ModuleSupport.Rect<WaterfallNodeDatum>>; isHighlight: boolean; }): void; protected updateLabelSelection(opts: { labelData: WaterfallNodeDatum[]; labelSelection: _ModuleSupport.Selection<WaterfallNodeDatum, _ModuleSupport.Text<WaterfallNodeDatum>>; }): _ModuleSupport.Selection<WaterfallNodeDatum, _ModuleSupport.Text<WaterfallNodeDatum>>; protected updateLabelNodes({ labelSelection, isHighlight, }: { labelSelection: _ModuleSupport.Selection<WaterfallNodeDatum, _ModuleSupport.Text<WaterfallNodeDatum>>; isHighlight: boolean; }): void; getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; private legendItemSymbol; getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; protected toggleSeriesItem(): void; protected resetDatumAnimation(data: WaterfallAnimationData): void; animateEmptyUpdateReady(opts: WaterfallAnimationData): void; protected animateConnectorLinesHorizontal(opts: WaterfallAnimationData): void; protected animateConnectorLinesVertical(opts: WaterfallAnimationData): void; animateReadyResize(data: WaterfallAnimationData): void; protected updatePaths(opts: { contextData: WaterfallContext; paths: _ModuleSupport.Path[]; }): void; resetConnectorLinesPath({ contextData, paths, }: { contextData: WaterfallContext; paths: Array<_ModuleSupport.Path>; }): void; protected updateLineNode(lineNode: _ModuleSupport.Path): void; protected isLabelEnabled(): boolean; protected computeFocusBounds({ datumIndex }: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; protected hasItemStylers(): boolean; } export {};