View as Markdown

API reference: @salmonui/pivot-table/engine

PivotValueFieldinterface

import type { PivotValueField } from '@salmonui/pivot-table/engine';

Also exported from @salmonui/pivot-table.

interface PivotValueField {
    readonly field: string;
    readonly caption?: string;
    readonly aggregate: PivotAggregate;
    readonly customId?: string;
    readonly showAs?: PivotShowAs;
}

A value field (one measure of the result).

Measure ids: every value field has a measure id, unique within model.values, used in PivotHeaderNode.measure, PivotCell.measure, header keys (...|<measure id>), valueSort.measure, value filters and formats. It is field when no other value field uses the same field, field#aggregate when one does (Freight#average, Freight#sampleStdev), and field#aggregate#index (position in model.values) when even that repeats. measureId(values, index) computes it. valueSort.measure, value filters and formats also accept the plain field (first match).

PivotValueField members (5)
NameSignatureDescription
fieldreadonly field: string;
captionoptionalreadonly caption?: string;
aggregatereadonly aggregate: PivotAggregate;
customIdoptionalreadonly customId?: string;

aggregate: 'custom': key into PivotEngineOptions.customAggregates.

showAsoptionalreadonly showAs?: PivotShowAs;