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

var jsonData = [{
    "Color": {
      "type": "string"
    },
    "M": {
      "type": "month",
      "caption": "Month"
    },
    "W": {
      "type": "weekday",
      "caption": "Week Day"
    },
    "Country": {
      "type": "level",
      "hierarchy": "Geography",
      "level": "Country"
    },
    "State": {
      "type": "level",
      "hierarchy": "Geography",
      "level": "State",
      "parent": "Country"
    },
    "City": {
      "type": "level",
      "hierarchy": "Geography",
      "parent": "State"
    },
    "Price": {
      "type": "number"
    },
    "Quantity": {
      "type": "number"
    }
  },
  {
    "Color": "blue",
    "M": "September",
    "W": "Wed",
    "Country": "Canada",
    "State": "Ontario",
    "City": "Toronto",
    "Price": 1474,
    "Quantity": 22
  },
  {
    "Color": "red",
    "M": "March",
    "W": "Mon",
    "Country": "USA",
    "State": "California",
    "City": "Los Angeles",
    "Price": 1664,
    "Quantity": 19
  },
  {
    "Color": "yellow",
    "M": "January",
    "W": "Mon",
    "Country": "Canada",
    "State": "Quebec",
    "City": "Montreal",
    "Price": 1190,
    "Quantity": 292
  },
  {
    "Color": "green",
    "D": "04/08/2014",
    "M": "August",
    "W": "Fri",
    "Country": "USA",
    "State": "California",
    "City": "Los Angeles",
    "Price": 4654,
    "Quantity": 0
  },
];

var pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    dataSource: {
      data: jsonData
    },
    slice: {
      rows: [{
        uniqueName: "Color"
      }],
      columns: [{
        uniqueName: "[Measures]"
      }],
      measures: [{
          uniqueName: "Price",
          aggregation: "sum"
        },
        {
          uniqueName: "Calculated value",
          formula: "if(sum(\"Quantity\") != 0, sum(\"Price\") / sum(\"Quantity\") , 0)",
          caption: "Calculated value"
        }
      ]
    },
    options: {
     ...