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
const pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
"dataSource": {
"data": getData()
},
"slice": {
"rows": [
{
"uniqueName": "Raw_material"
},
{
"uniqueName": "[Measures]"
}
],
"columns": [
{
"uniqueName": "Analysis"
}
],
"measures": [
{
"uniqueName": "Price"
},
{
"uniqueName": "Discount"
}
]
},
"options": {
"grid": {
"showTotals": "off",
"showGrandTotals": "off"
}
},
"formats": [
{
"name": "32v30m1y",
"decimalPlaces": 2,
"currencySymbol": "%",
"currencySymbolAlign": "right"
}
]
},
width: "100%",
height: 370
});
function getData() {
return [{
"Raw_material": "Wheat",
"Analysis": "AME",
"Price": 1990,
"Discount": 50
}, {
"Raw_material": "Wheat",
"Analysis": "STDAA",
"Price": 1000,
"Discount": 60
}, {
"Raw_material": "Wheat",
"Analysis": "AME",
"Price": 1064,
"Discount": 70
}, {
"Raw_material": "Wheat",
"Analysis": "STDAA",
"Price": 18514,
"Discount": 80
}
];
}