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
let pivot = new Flexmonster({
container: "pivotContainer",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
data: getData()
},
"slice": {
"rows": [{
"uniqueName": "Item"
}],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Price",
"aggregation": "sum"
},
{
"uniqueName": "Tax",
"aggregation": "max"
},
{
"uniqueName": "Total price with taxes",
"formula": "sum(\"Price\") * max(\"Tax\")",
"caption": "Total price with taxes"
}
]
}
}
});
function getData() {
return [{
Item: "Car",
Price: 15000,
Tax: 1.13
},
{
Item: "Bike",
Price: 8000,
Tax: 1.13
},
{
Item: "Car",
Price: 26000,
Tax: 1.13
},
{
Item: "Plane",
Price: 200000,
Tax: 1.13
}
]
}