plotly/react-pivottable

Custom Aggregators

farhanabdmusa opened this issue · 0 comments

Hi, can i get little to create custom aggregators?

I have js code for aggregators and now i want to use it on NextJS

this is the example of my code

var tpl = $.pivotUtilities.aggregatorTemplates;
var fmtKg = $.pivotUtilities.numberFormat({suffix: ""});

$("#output").pivotUI(data, {
  renderers: renderers,
  cols: ["Country", "Month"],
  rows: ["Year", ],
  rowOrder: "key_a_to_z",
  colOrder: "key_a_to_z",
  aggregators: {
    "Net Weight (KG)": function () {
      return tpl.sum(fmtKg)(["netweight"]);
    },
  },
  rendererName: "Table",
});

Thank you