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 pivot = new Flexmonster({
  container: "#pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    "dataSource": {
      "type": "json",
      "data": getData()
    },
    "slice": {
      "columns": [{
          "uniqueName": "Date.Year"
        }
      ],
      "rows": [{
          "uniqueName": "Item"
        },
        {
          "uniqueName": "[Measures]"
        }
      ],
      "measures": [{
        "uniqueName": "Price",
        "aggregation": "sum"
      }, {
        "uniqueName": "Price",
        "aggregation": "%difference"
      }]
    },
    "formats": [{
      "name": "-19d94uapket200",
      "decimalPlaces": 2,
      "isPercent": true
    }],
    "options": {
      "grid": {
        "showGrandTotals": false
      }
    }
  },
  width: "100%",
  height: 500
});


function getData() {
  return [{
      "Date": {
        "type": "date"
      },
      "Item": {
        "type": "string"
      },
      "Price": {
        "type": "number"
      }
    },
    {
      "Date": "2017-03-20",
      "Price": 80,
      "Item": "item1"
    },
    {
      "Date": "2018-03-20",
      "Price": 160,
      "Item": "item1"
    },
    {
      "Date": "2017-03-20",
      "Price": 130,
      "Item": "item2"
    }, {
      "Date": "2018-03-20",
      "Price": 40,
      "Item": "item2"
    },
    {
      "Date": "2017-03-20",
      "Price": 110,
      "Item": "item3"
    }, {
      "Date": "2018-03-20",
      "Price": 67,
      "Item": "item3"
    }
  ]
}