Interface SelectionAggregatesIf

Count, sum, average, minimum and maximum of the selected body cells – for a status bar like in a spreadsheet (TableApi.getSelectionAggregates).

Counted are the selected cells of the visible data columns (row number and checkbox columns not); numericCount, sum, avg, min, max use the cells whose value is a number.

Example

const a: SelectionAggregatesIf = tableApi.getSelectionAggregates();
const text = a.capped ? "selection too large"
: a.numericCount ? `Count ${a.count} · Sum ${formatAggregateValue(a.sum)} · Avg ${formatAggregateValue(a.avg)}`
: a.count ? `Count ${a.count}` : "";

Since

1.1.94

Hierarchy

  • SelectionAggregatesIf

Properties

avg: undefined | number

Average of the numbers (undefined without numbers).

capped: boolean

true if the selection covers more than SelectionAggregator.maxCells cells: then nothing is computed (all values 0 / undefined) – a partial sum would be wrong.

count: number

Number of selected cells.

max: undefined | number

Largest number (undefined without numbers).

min: undefined | number

Smallest number (undefined without numbers).

numericCount: number

Number of selected cells with a number.

sum: number

Sum of the numbers (0 without numbers).