nicolaskruchten / pivottable

Open-source Javascript Pivot Table (aka Pivot Grid, Pivot Chart, Cross-Tab) implementation with drag'n'drop.
https://pivottable.js.org/
MIT License
4.33k stars 1.07k forks source link

Show absolute value in display, use actual value in aggregator #1346

Open MayankHatsOff opened 8 months ago

MayankHatsOff commented 8 months ago

Update pivot.js to below numberFormat = function(opts) { var defaults; defaults = { digitsAfterDecimal: 2, scaler: 1, thousandsSep: ",", decimalSep: ".", prefix: "", suffix: "", ABS: 0 }; opts = $.extend({}, defaults, opts); return function(x) { var result; if (isNaN(x) || !isFinite(x)) { return ""; } if (opts.ABS == 1) { x = Math.abs(x); } result = addSeparators((opts.scaler * x).toFixed(opts.digitsAfterDecimal), opts.thousandsSep, opts.decimalSep); return "" + opts.prefix + result + opts.suffix; }; };