JSFiddle - React, Tailwind, and code Playground

by Flexmonster Pivot Table

HTML

<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<div id="pivot-container">The component will appear here</div>
<div class="output" id="output"></div>

CSS

.output {
  width: 80%;
  height: 300px;
  margin-left: auto;
  margin-right: auto;
  padding: 20px;
  background: rgba(242, 242, 242, 1);
  font-family: Menlo, Monaco, "Courier New", Courier, monospace;
  white-space: pre;
  font-size: 16px;
  font-weight: 400;
  overflow-y: scroll;
  margin-top: 20px;
}

JavaScript

let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  licenseFilePath: "https://cdn.flexmonster.com/jsfiddle.charts.key",
  toolbar: true,
  height: 350,
  report: {
    "dataSource": {
      "filename": 'data/data.csv'
    },
    "slice": {
      "rows": [{
        "uniqueName": "Color"
      }],
      "columns": [{
          "uniqueName": "Category",
          "filter": {
            "members": [
              "category.[accessories]",
            ]
          }
        },
        {
          "uniqueName": "[Measures]"
        }
      ],
      "measures": [{
          "uniqueName": "Price"
        },
        {
          "formula": 'sum("Price") * 2',
          "uniqueName": "Custom Formula"
        }
      ]
    }
  }
});

//getting the grand total of "Custom Formula"
flexmonster.getData({}, function(data) {
  showOutput(data.data[0].v1);
});

function showOutput(content) {
  document.getElementById("output").innerText = "Grand Total of Custom Formula: " + content;
}