JSFiddle - React, Tailwind, and code Playground

by Flexmonster Pivot Table

HTML

<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>

JavaScript

let jsonData = [{
    "Category": "Accessories",
    "Color": "red",
    "Pieces": 200,
    "Price": 0
  },
  {
    "Category": "Accessories",
    "Color": "white",
    "Pieces": 200,
    "Price": 0
  },
  {
    "Category": "Bike",
    "Color": "white",
    "Pieces": 200,
    "Price": 78
  }
];


let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    dataSource: {
      type: "json",
      data: jsonData,
      mapping: {
        "Category": {
          "type": "string"
        },
        "Color": {
          "type": "string"
        },
        "Price": {
          "type": "number"
        },
        "Pieces": {
          "type": "number"
        },
      }
    },
    slice: {
      "rows": [{
        "uniqueName": "Category"
      }, {
        "uniqueName": "Color",
        "filter": {
          "measure": {
            "uniqueName": "Price",
            "aggregation": "sum"
          },
          "query": {
            "greater": 0
          }
        }
      }],
      "columns": [{
        "uniqueName": "[Measures]"
      }],
      "measures": [{
        "uniqueName": "Price"
      }, {
        "uniqueName": "Pieces"
      }]
    }
  }
});