JSFiddle - React, Tailwind, and code Playground

by Flexmonster Pivot Table

HTML

<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<div id="pivot-container"></div>

JavaScript

let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    dataSource: {
      type: "json",
      data: getData()
    },
    slice: {
      rows: [{
        uniqueName: "Color"
      }],
      columns: [{
        uniqueName: "[Measures]"
      }],
      measures: [{
          uniqueName: "Price USD",
          formula: "if( sum(\"CurrencyCode\") = 1 , sum(\"Price\")  , 0 )",
          individual: true,
          caption: "Price USD",
          format: "USD"
        },
        {
          uniqueName: "Price EUR",
          formula: "if( sum(\"CurrencyCode\") = 2, sum(\"Price\") , 0)",
          individual: true,
          caption: "Price EUR",
          format: "EUR"
        }
      ]
    },
    formats: [{
        name: "USD",
        decimalPlaces: 2,
        currencySymbol: "$"
      },
      {
        name: "EUR",
        decimalPlaces: 2,
        currencySymbol: "€"
      },
    ],
  }
});

function getData() {
  return [{
      "Category": "Accessories",
      "Size": "262 oz",
      "Color": "red",
      "CurrencyCode": 2,
      "Destination": "Australia",
      "Business Type": "Specialty Bike Shop",
      "Country": "Australia",
      "Price": 174,
      "Quantity": 225,
      "Discount": 23
    },
    {
      "Category": "Accessories",
      "Size": "214 oz",
      "Color": "red",
      "CurrencyCode": 1,
      "Destination": "Canada",
      "Business Type": "Specialty Bike Shop",
      "Country": "Canada",
      "Price": 502,
      "Quantity": 90,
      "Discount": 17
    },
    {
      "Category": "Accessories",
      "Size": "147 oz",
      "Color": "red",
      "CurrencyCode": 2,
      "Destination": "France",
      "Business Type": "Specialty Bike Shop",
      "Country": "France",
      "Price": 242,
      "Quantity": 855,
      "Discount": 37
    },
    {
      "Category": "Accessories",
      "Size": "112 oz",
      "Color": "red",
      "CurrencyCode": 1,
    ...