JSFiddle - React, Tailwind, and code Playground

Slice configuration

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: {
      data: getData(),
    },
    slice: {
      rows: [{
        uniqueName: "Color",
        sortOrder: ["green", "yellow", "red", "blue"]
      }],
      columns: [{
        uniqueName: "[Measures]"
      }],
      measures: [{
        uniqueName: "Price"
      }]
    }
  }
});

function getData() {
  return [{
    "Color": "red",
    "Price": 174
  }, {
    "Color": "blue",
    "Price": 15
  }, {
    "Color": "yellow",
    "Price": 33
  }, {
    "Color": "green",
    "Price": 333
  }]
}