Check documentation for the latest version of DHTMLX Pivot addMathMethod Pivot Docs

addMathMethod

adds a custom operation

void addMathMethod(string name,string label,function function);
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);
});

Details

Related sample:  Custom methods

See also
Back to top