UNPKG

ag-charts-enterprise

Version:

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

155 lines (154 loc) 7.69 kB
import type { AgHeatmapSeriesOptions, AgHeatmapSeriesStyle, FontStyle, FontWeight, SelectionState, TextAlign, VerticalAlign } from 'ag-charts-community'; import { _ModuleSupport } from 'ag-charts-community'; import { ChartAxisDirection, type DomainWithMetadata, type DynamicContext, type FillStrokeMorph, type Normalised, type NormalisedTextOrSegments, type Point, type SizedPoint } from 'ag-charts-core'; import { HeatmapSeriesProperties } from './heatmapSeriesProperties'; type NormalisedHeatmapSeriesStyle = Normalised<AgHeatmapSeriesStyle, never, FillStrokeMorph>; interface HeatmapNodeDatum extends _ModuleSupport.CartesianSeriesNodeDatum { readonly point: Readonly<SizedPoint>; midPoint: Readonly<Point>; readonly width: number; readonly height: number; readonly colorValue: any; style: NormalisedHeatmapSeriesStyle; } interface HeatmapLabelDatum extends Point { datumIndex: number; series: _ModuleSupport.CartesianSeriesNodeDatum['series']; datum: any; itemId?: never; text: NormalisedTextOrSegments; fontSize: number; lineHeight: number; fontStyle: FontStyle | undefined; fontFamily: string; fontWeight: FontWeight | undefined; color: string | undefined; textAlign: TextAlign; textBaseline: VerticalAlign; style: NormalisedHeatmapSeriesStyle; } /** Context object caching expensive lookups for createNodeData(). */ interface HeatmapSeriesNodeDatumContext extends _ModuleSupport.CartesianCreateNodeDataContext<HeatmapNodeDatum> { readonly yKey: string; readonly xOffset: number; readonly yOffset: number; readonly width: number; readonly height: number; readonly textAlignFactor: number; readonly verticalAlignFactor: number; readonly yValues: any[]; readonly colorKey: string | undefined; readonly colorName: string | undefined; readonly colorValues: number[] | undefined; readonly colorDomain: number[]; readonly itemPadding: number; readonly labels: HeatmapLabelDatum[]; labelIndex: number; } declare class HeatmapSeriesNodeEvent<TEvent extends string = _ModuleSupport.SeriesNodeEventTypes> extends _ModuleSupport.CartesianSeriesNodeEvent<TEvent> { readonly colorKey?: string; constructor(type: TEvent, nativeEvent: Event, datum: HeatmapNodeDatum, series: HeatmapSeries, selectionState: SelectionState | undefined); } /** * Consolidated type interface for HeatmapSeries. * Defines all type parameters in one place for the series. */ interface HeatmapSeriesTypes extends _ModuleSupport.CartesianSeriesTypes { readonly node: _ModuleSupport.Rect<HeatmapNodeDatum>; readonly options: AgHeatmapSeriesOptions; readonly properties: HeatmapSeriesProperties; readonly datum: HeatmapNodeDatum; readonly label: HeatmapLabelDatum; readonly context: _ModuleSupport.CartesianSeriesNodeDataContext<HeatmapNodeDatum, HeatmapLabelDatum>; readonly stackContext: never; readonly createNodeDataContext: HeatmapSeriesNodeDatumContext; } export declare class HeatmapSeries extends _ModuleSupport.CartesianSeries<HeatmapSeriesTypes> { static readonly className = "HeatmapSeries"; static readonly type: "heatmap"; properties: HeatmapSeriesProperties; protected readonly NodeEvent: typeof HeatmapSeriesNodeEvent; readonly colorScale: _ModuleSupport.ColorScale; constructor(moduleCtx: DynamicContext<_ModuleSupport.ChartRegistry>); processData(dataController: _ModuleSupport.DataController): Promise<void>; private isColorScaleValid; xCoordinateRange(xValue: any, pixelSize: number): [number, number]; yCoordinateRange(yValues: any[], pixelSize: number): [number, number]; getSeriesDomain(direction: ChartAxisDirection): DomainWithMetadata<any>; getSeriesRange(): [number, number]; /** * Template method hook: Validates preconditions for createNodeData. * Overrides base to add heatmap-specific category axis validation. */ protected validateCreateNodeDataPreconditions(): { xAxis: _ModuleSupport.ChartAxis; yAxis: _ModuleSupport.ChartAxis; } | undefined; /** * Template method hook: Iterates over data and creates/updates node datums. */ protected populateNodeData(ctx: HeatmapSeriesNodeDatumContext): void; /** * Template method hook: Creates the result object shell. */ protected initializeResult(ctx: HeatmapSeriesNodeDatumContext): _ModuleSupport.CartesianSeriesNodeDataContext<HeatmapNodeDatum, HeatmapLabelDatum>; /** * Template method hook: Creates the shared context for datum creation. * Caches expensive lookups and computations that are constant across all datums. */ protected createNodeDatumContext(xAxis: _ModuleSupport.ChartAxis, yAxis: _ModuleSupport.ChartAxis): HeatmapSeriesNodeDatumContext | undefined; /** * Creates a skeleton HeatmapNodeDatum with minimal required fields. * The node will be populated by updateNodeDatum. */ private createSkeletonNodeDatum; /** * Updates an existing HeatmapNodeDatum in-place. */ private updateNodeDatum; /** * Creates a HeatmapNodeDatum for a single data point. * Returns undefined for invalid data points (e.g., null/undefined keys when not allowed). */ private createNodeDatum; private createLabelDatum; protected nodeFactory(): _ModuleSupport.Rect<HeatmapNodeDatum>; update(params: { seriesRect?: _ModuleSupport.BBox; }): void; protected updateDatumSelection(opts: { nodeData: HeatmapNodeDatum[]; datumSelection: _ModuleSupport.Selection<HeatmapNodeDatum, _ModuleSupport.Rect<HeatmapNodeDatum>>; }): _ModuleSupport.Selection<HeatmapNodeDatum, _ModuleSupport.Rect<HeatmapNodeDatum>>; protected getItemStyle({ datumIndex, datum, colorValue }: Partial<HeatmapNodeDatum>, isHighlight: boolean, highlightState?: _ModuleSupport.HighlightState): NormalisedHeatmapSeriesStyle; private makeItemStylerParams; protected updateDatumStyles({ datumSelection, isHighlight, }: { datumSelection: _ModuleSupport.Selection<HeatmapNodeDatum, _ModuleSupport.Rect<HeatmapNodeDatum>>; isHighlight: boolean; }): void; protected updateDatumNodes({ datumSelection, }: { datumSelection: _ModuleSupport.Selection<HeatmapNodeDatum, _ModuleSupport.Rect<HeatmapNodeDatum>>; isHighlight: boolean; }): void; protected updateLabelSelection(opts: { labelData: HeatmapLabelDatum[]; labelSelection: _ModuleSupport.Selection<HeatmapLabelDatum, _ModuleSupport.Text<HeatmapLabelDatum>>; }): _ModuleSupport.Selection<HeatmapLabelDatum, _ModuleSupport.Text<HeatmapLabelDatum>>; protected updateLabelNodes(opts: { labelSelection: _ModuleSupport.Selection<HeatmapLabelDatum, _ModuleSupport.Text<HeatmapLabelDatum>>; isHighlight?: boolean; }): void; getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[] | _ModuleSupport.GradientLegendDatum[]; protected isLabelEnabled(): boolean; getBandScalePadding(): { inner: number; outer: number; }; protected computeFocusBounds({ datumIndex }: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; protected initQuadTree(quadtree: _ModuleSupport.QuadtreeNearest<HeatmapNodeDatum>): void; protected pickNodesExactShape(point: Point): _ModuleSupport.SeriesNodeDatum[]; protected pickNodeClosestDatum(point: Point): _ModuleSupport.SeriesNodePickMatch | undefined; protected hasItemStylers(): boolean; } export {};