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="pivotContainerFlat" class="container"></div>
<div id="pivotContainerPivot" class="container"></div>
CSS
.container {
float: left;
}
JavaScript
var pivot = new Flexmonster({
container: "pivotContainerPivot",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: false,
width: "50%",
report: {
dataSource: {
filename: "https://www.flexmonster.com/fm_uploads/2020/04/data2636.json",
mapping: {
"Date": {
"type": "date string"
},
"Feasibility": {
"type": "number"
},
"Forecats": {
"type": "number"
},
"Actual": {
"type": "number"
},
"GL Code": {
"type": "string"
},
"Cost Centre": {
"type": "string"
}
}
},
"slice": {
"rows": [{
"uniqueName": "Cost Centre"
},
{
"uniqueName": "GL Code"
}
],
"columns": [{
"uniqueName": "Date"
},
{
"uniqueName": "[Measures]"
}
],
"measures": [{
"uniqueName": "Feasibility",
"aggregation": "sum"
}],
"expands": {
"expandAll": true
}
},
"formats": [{
"name": "",
"thousandsSeparator": ",",
"decimalPlaces": 2,
"currencySymbol": "$"
}],
"options": {
"configuratorButton": false
}
}
});
var pivot = new Flexmonster({
container: "pivotContainerFlat",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: false,
width: "50%",
report: {
"dataSource": {
"data": getData()
},
"slice": {
"rows": [{
"uniqueName": "Notes"
}],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Forecast",
"aggregation": "sum"
},
{
"uniqueName": "Feaso",
"aggregation": "sum"
},
{
"uniqueName": "Feaso +/-",
"formula": "sum(\"Forecast\") - sum(\"Feaso\")",
"caption": "Feaso +/-"
}
],
"flatOrder": [
...