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
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
"options": {
"grid": {
"showTotals": "off",
"showGrandTotals": "off"
}
},
dataSource: {
data: getData(),
mapping: {
Date: {
type: "date string"
}
}
},
slice: {
rows: [{
uniqueName: "Color"
}],
columns: [{
uniqueName: "Date"
}, {
uniqueName: "[Measures]"
}],
measures: [{
uniqueName: "Formula #1",
caption: "Formula #1",
formula: "if(max('Date') = 1723150800000, 1000, 0"
}]
}
}
});
function getData() {
return [{
"Date": "2024-08-09",
"Color": "blue",
"Price": 222
},
{
"Date": "2022-03-22",
"Color": "blue",
"Price": 222
},
]
}