@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
18 lines (17 loc) • 793 B
TypeScript
import { IAggFuncParams } from 'ag-grid-enterprise';
/**
* Computes a weighted average aggregation: Σ(value × weight) / Σ(weight)
*
* AG Grid calls agg functions bottom-up through the group hierarchy. For each group:
* - Leaf children contribute their raw value × weight
* - Sub-group children already have partial sums from a previous pass,
* so we combine those directly instead of re-traversing to leaves
*
* The returned object stores partial sums ([columnId] and [weightColumnId])
* so parent groups can combine sub-group results correctly.
*/
export declare const weightedAverage: (params: IAggFuncParams, columnId: string, weightColumnId: string) => {
[x: string]: number | (() => string) | (() => number);
toString: () => string;
toNumber: () => number;
};