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()
},
"slice": {
"rows": [{
"uniqueName": "item"
}],
"columns": [{
"uniqueName": "date.Month"
},
{
"uniqueName": "[Measures]"
}
],
"measures": [{
"uniqueName": "price",
"aggregation": "sum",
},
{
"uniqueName": "price",
"aggregation": "%differenceofrow",
"format": "-1arlk225rdf100"
}
]
},
"formats": [{
"name": "-1arlk225rdf100",
"decimalPlaces": 2
}],
"options": {
"grid": {
"showGrandTotals": "off"
}
}
}
});
function getData() {
return [{
"date": "2019-01-13",
"item": "car",
"price": 328563
},
{
"date": "2019-01-22",
"item": "aircraft",
"price": 365721
},
{
"date": "2019-02-14",
"item": "car",
"price": 524562
},
{
"date": "2019-02-11",
"item": "aircraft",
"price": 876466
},
{
"date": "2019-03-01",
"item": "car",
"price": 100000
},
{
"date": "2019-03-23",
"item": "aircraft",
"price": 8679
}
]
}