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%",
  height: 430,
  toolbar: true,
  customizeCell: customizeCell,
  report: {
    dataSource: {
      dataSourceType: "json",
      data: getData()
    },
    slice: {
      rows: [{
        uniqueName: "Color"
      }],
      columns: [{
        uniqueName: "[Measures]"
      }],
      measures: [{
          uniqueName: "Price"
        },
        {
          uniqueName: "Quantity"
        },
        {
          caption: 'test',
          uniqueName: "test",
          formula: 'sum("Price") / 2',
        	calculateNaN: false
        }
      ]
    }
  }
});

function customizeCell(cell, data) {
  if (data.type == "value") {
  	if (isNaN(data.value) && data.measure.uniqueName == "test") {
    	cell.text = "N/A";
    }
  }
}

function getData() {
  return [{
    "Color": "green",
    "M": "September",
    "W": "Wed",
    "country": "Canada",
    "state": "Ontario",
    "city": "Toronto",
    "Price": 174,
    "Quantity": 22
  }, {
    "Color": "yellow",
    "M": "October",
    "W": "Thu",
    "country": "Canada",
    "state": "Ontario",
    "city": "Toronto",
    "Price": -1,
    "Quantity": 22
  }, {
    "Color": "blue",
    "M": "April",
    "W": "Fri",
    "country": "Canada",
    "state": "Ontario",
    "city": "Toronto",
    "Price": 0,
    "Quantity": 22
  }, {
    "Color": "red",
    "M": "March",
    "W": "Mon",
    "Time": "1000",
    "country": "USA",
    "state": "California",
    "city": "Los Angeles",
    "Price": "",
    "Quantity": 19
  }];
}