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="pivotContainer"></div>

JavaScript

var pivot = new Flexmonster({
  container: "pivotContainer",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    dataSource: {
      data: getData(),
      mapping: {
        "Date": {
          type: "date string"
        },
        "Tenure": {
          type: "string"
        },
        "Days In Position": {
          type: "number"
        }
      }
    },
    "slice": {
      "rows": [{
        "uniqueName": "Date"
      }],
      "columns": [{
          "uniqueName": "Tenure"
        },
        {
          "uniqueName": "[Measures]"
        }
      ],
      "measures": [{
        "uniqueName": "Days In Position",
        "aggregation": "average"
      }]
    }
  }
});

let sorting = {
  "3-6 months": 1,
  "6 months - 1 year": 2,
  "1-2 years": 3,
  "2-4 years": 4,
  "4-6 years": 5,
  "6-10 years": 6,
  "10+ years": 7
};

pivot.sortingMethod("Tenure", function(a, b) {
  return sorting[a] > sorting[b] ? 1 : -1;
});

function getData() {
  return [{
      "Date": "2020-01-05T13:23:03+00:00",
      "Tenure": "3-6 months",
      "Days In Position": 430
    },
    {
      "Date": "2020-02-19T20:25:16+00:00",
      "Tenure": "2-4 years",
      "Days In Position": 107
    },
    {
      "Date": "2020-03-20T21:26:28+00:00",
      "Tenure": "6-10 years",
      "Days In Position": 120
    },
    {
      "Date": "2020-03-24T17:53:41+00:00",
      "Tenure": "1-2 years",
      "Days In Position": 346
    },
    {
      "Date": "2020-01-31T18:49:37+00:00",
      "Tenure": "3-6 months",
      "Days In Position": 491
    },
    {
      "Date": "2020-03-21T15:32:09+00:00",
      "Tenure": "10+ years",
      "Days In Position": 386
    },
    {
      "Date": "2020-01-05T22:01:21+00:00",
      "Tenure": "4-6 years",
      "Days In Position": 165
    },
    {
      "Date": "2020-05-08T13:35:26+00:00",
      "Tenure": "4-6 years",
      "Days In Position": 483
    },
    {
      "Date": "2020-01-25T04:30:03+00:00",
      "Tenure": "3-6 months",
   ...