addMathMethod

adds a custom operation

void addMathMethod(string name,string label,function function);

Parameters

namestringthe name of the new operation
labelstringthe label of the new operation
functionfunctionthe function that will be called for cells assigned to this operation

Example

myPivot.addMathMethod("avr", "Avr", (cellData) => {
    const sum = cellData.reduce((el, all) => all += el);
    return (sum / cellData.length).toFixed(3);
});

Related samples

See also
Back to top