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: {
dataSource: {
data: getData(),
mapping: {
"Date": {
type: "year/month/day",
},
}
},
slice: {
rows: [
{
uniqueName: "[Measures]"
}
],
columns: [
{
uniqueName: "Date"
}
],
measures: [
{
uniqueName:"Price",
aggregation:"sum"
}
]
},
}
});
function getData() {
return [
{
"Date": "2021-03-04T22:52:00",
"Price":10
},
{
"Date": "2020-01-11T23:55:00",
"Price":10
},
{
"Date": "2021-03-08T22:45:00",
"Price":10
}
]
}