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>

CSS

h2 {
  text-align: center;
}

p {
  font-size: 15px;
  line-height: 1.5;
  padding-right: 10px;
  padding-left: 10px;
}

a {
  color: #00a45a;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
    font-size: 105%;
    color: #DF3800;
    background-color: #f5f5f5;
    padding: 1px 4px;
    font-family: monospace !important;
    border-radius: 4px;
}

JavaScript

let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  height: 400,
  toolbar: true,
  report: {
    options: {
      showEmptyValues: "columns"
    },
    dataSource: {
      data: getData(),
      mapping: {
        "Continent": {
          hierarchy: "Geography",
        },
        "Country": {
          hierarchy: "Geography",
          parent: "Continent"
        },
        "Date": {
          type: "date"
        }
      }
    },

    slice: {
      rows: [{
        "uniqueName": "Color"
      }],
      columns: [{
          "uniqueName": "Geography"
        },
        {
          "uniqueName": "Date.Month"
        },
        {
          "uniqueName": "[Measures]"
        }
      ],
      measures: [{
        uniqueName: "Price",
        aggregation: "sum"
      }],
      drills: {
        "columns": [{
            "tuple": [
              "geography.[america]"
            ]
          },
          {
            "tuple": [
              "geography.[europe]"
            ]
          }
        ]
      }

    }
  }
});

function getData() {
  return [{
      "Color": "blue",
      "Country": "Canada",
      "Continent": "America",
      "Date": "2023-04-12",
      "Price": 174
    }, {
      "Color": "blue",
      "Country": "London",
      "Continent": "Europe",
      "Date": "2023-04-12",
      "Price": 174
    },
    {
      "Continent": "Europe",
      "Color": "blue",
      "Date": "2023-03-12",
      "Price": 166
    }
  ];
}