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/",
  width: "100%",
  toolbar: true,
  report: {
    dataSource: {
      data: getData(),
      mapping: {
        "Date": {
          type: "date string",
        }
      }
    },
    options: {
      datePattern: "yyyy-MM-dd"
    },
    slice: {
      rows: [
        {
          uniqueName: "Color"
        }
      ],
      columns: [{
          "uniqueName": "Date"
        },
        {
          "uniqueName": "[Measures]"
        }
      ],
      measures: [{
        uniqueName: "Price"
      }]
    }
  },
  global: {
    localization: {
      grid: {
        dateInvalidCaption: "0001-01-01"
      }
    }
  }
});

function getData() {
  return [{
    "Color": "green",
    "Price": 100,
    "Quantity": 50,
    "Date": "2024-04-07"
  },
  {
    "Color": "red",
    "Price": 100,
    "Quantity": 50,
    "Date": "2024-04-07"
  },{
    "Color": "green",
    "Price": 100,
    "Quantity": 50,
    "Date": "2024-04-08"
  },{
    "Color": "red",
    "Price": 100,
    "Quantity": 50,
    "Date": "2024-04-08"
  }, {
    "Color": "red",
    "Price": 100,
    "Quantity": 50,
    "Date": ""
  },
   {
    "Color": "red",
    "Price": 100,
    "Quantity": 50
  }];
}