ag-charts-enterprise
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
146 lines (145 loc) • 6.65 kB
TypeScript
import { type AgBoxPlotSeriesOptions, type AgBoxPlotSeriesStyle, type SelectionState, _ModuleSupport } from 'ag-charts-community';
import type { DynamicContext } from 'ag-charts-core';
import { ChartAxisDirection } from 'ag-charts-core';
import { BoxPlotNode } from './boxPlotNode';
import { BoxPlotSeriesProperties } from './boxPlotSeriesProperties';
import type { BoxPlotNodeDatum } from './boxPlotTypes';
interface BoxPlotSeriesNodeDataContext extends _ModuleSupport.AbstractBarSeriesNodeDataContext<BoxPlotNodeDatum> {
styles: _ModuleSupport.SeriesNodeStyleContext<AgBoxPlotSeriesStyle>;
}
/**
* Consolidated type interface for BoxPlotSeries.
* Defines all type parameters in one place for the series.
*/
interface BoxPlotSeriesTypes extends _ModuleSupport.AbstractBarSeriesTypes {
readonly node: BoxPlotNode;
readonly options: AgBoxPlotSeriesOptions;
readonly properties: BoxPlotSeriesProperties;
readonly datum: BoxPlotNodeDatum;
readonly label: BoxPlotNodeDatum;
readonly context: BoxPlotSeriesNodeDataContext;
readonly stackContext: never;
readonly createNodeDataContext: BoxPlotSeriesNodeDatumContext;
}
/** Context object caching expensive lookups for createNodeData(). */
interface BoxPlotSeriesNodeDatumContext extends _ModuleSupport.CartesianCreateNodeDataContext<BoxPlotNodeDatum> {
readonly minValues: any[];
readonly q1Values: any[];
readonly medianValues: any[];
readonly q3Values: any[];
readonly maxValues: any[];
readonly barWidth: number;
readonly barOffset: number;
readonly groupOffset: number;
readonly isVertical: boolean;
readonly xKey: string;
}
declare class BoxPlotSeriesNodeEvent<TEvent extends string = _ModuleSupport.SeriesNodeEventTypes> extends _ModuleSupport.SeriesNodeEvent<BoxPlotNodeDatum, TEvent> {
readonly xKey?: string;
readonly minKey?: string;
readonly q1Key?: string;
readonly medianKey?: string;
readonly q3Key?: string;
readonly maxKey?: string;
constructor(type: TEvent, nativeEvent: Event, datum: BoxPlotNodeDatum, series: BoxPlotSeries, selectionState: SelectionState | undefined);
}
export declare class BoxPlotSeries extends _ModuleSupport.AbstractBarSeries<BoxPlotSeriesTypes> {
static readonly className = "BoxPlotSeries";
static readonly type: "box-plot";
properties: BoxPlotSeriesProperties;
protected readonly NodeEvent: typeof BoxPlotSeriesNodeEvent;
constructor(moduleCtx: DynamicContext<_ModuleSupport.ChartRegistry>);
processData(dataController: _ModuleSupport.DataController): Promise<void>;
getSeriesDomain(direction: ChartAxisDirection): {
domain: never[];
sortMetadata?: undefined;
} | {
domain: any[];
sortMetadata: {
sortOrder: 1 | -1 | undefined;
isUnique?: boolean | undefined;
} | undefined;
} | {
domain: [] | [number, number];
sortMetadata?: undefined;
};
getSeriesRange(_direction: ChartAxisDirection, visibleRange: [number, number]): [number, number];
/**
* 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): BoxPlotSeriesNodeDatumContext | undefined;
/**
* Validates box plot values and checks ordering constraints.
* Returns true if values are valid (all numbers, min <= q1 <= median <= q3 <= max).
*/
private validateBoxPlotValues;
/**
* Computes scaled values for a single datum.
* Populates the scratch object to avoid allocations.
*/
private computeScaledValues;
/**
* Creates a skeleton BoxPlotNodeDatum with minimal required fields.
* The node will be populated by updateNodeDatum.
*/
private createSkeletonNodeDatum;
/**
* Updates an existing BoxPlotNodeDatum in-place.
* This is more efficient than recreating the entire node when only data values change.
*/
private updateNodeDatum;
/**
* Creates a BoxPlotNodeDatum for a single data point.
* Creates a skeleton node and uses updateNodeDatum to populate it.
*/
private createNodeDatum;
/**
* Initialize the result object shell before populating node data.
*/
protected initializeResult(ctx: BoxPlotSeriesNodeDatumContext): BoxPlotSeriesNodeDataContext;
/**
* Populate node data by iterating over raw data.
*/
protected populateNodeData(ctx: BoxPlotSeriesNodeDatumContext): void;
/**
* Finalize node data by trimming excess nodes.
*/
protected finalizeNodeData(ctx: BoxPlotSeriesNodeDatumContext): void;
/**
* Assemble the final result with computed fields.
*/
protected assembleResult(ctx: BoxPlotSeriesNodeDatumContext, result: BoxPlotSeriesNodeDataContext): BoxPlotSeriesNodeDataContext;
private legendItemSymbol;
getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[];
getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined;
protected animateEmptyUpdateReady({ datumSelection, }: _ModuleSupport.CartesianAnimationData<BoxPlotNodeDatum, BoxPlotNode>): void;
protected isLabelEnabled(): boolean;
protected updateDatumSelection(opts: {
nodeData: BoxPlotNodeDatum[];
datumSelection: _ModuleSupport.Selection<BoxPlotNodeDatum, BoxPlotNode>;
seriesIdx: number;
}): _ModuleSupport.Selection<BoxPlotNodeDatum, BoxPlotNode>;
private makeStylerParams;
private getStyle;
private getItemStyle;
private makeItemStylerParams;
protected updateDatumStyles({ datumSelection, isHighlight, }: {
datumSelection: _ModuleSupport.Selection<BoxPlotNodeDatum, BoxPlotNode>;
isHighlight: boolean;
}): void;
protected updateDatumNodes({ datumSelection, isHighlight, }: {
datumSelection: _ModuleSupport.Selection<BoxPlotNodeDatum, BoxPlotNode>;
isHighlight: boolean;
}): void;
protected updateLabelNodes(): void;
protected updateLabelSelection(opts: {
labelData: BoxPlotNodeDatum[];
labelSelection: _ModuleSupport.Selection<BoxPlotNodeDatum, _ModuleSupport.Text<BoxPlotNodeDatum>>;
seriesIdx: number;
}): _ModuleSupport.Selection<BoxPlotNodeDatum, _ModuleSupport.Text<BoxPlotNodeDatum>>;
protected nodeFactory(): BoxPlotNode;
protected computeFocusBounds({ datumIndex }: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined;
protected hasItemStylers(): boolean;
}
export {};