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
var pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
dataSourceType: "json",
data: getData()
},
slice: {
rows: [
{
uniqueName: "Person"
},
{
uniqueName: "On Date"
}
],
columns: [
{
uniqueName: "[Measures]"
}
],
measures: [
{
uniqueName: "Transport Charges",
aggregation: "sum"
}
],
expands: {
rows: [
{
tuple: [
"person.[bob]"
]
},
{
tuple: [
"person.[mike]"
]
},
{
tuple: [
"person.[steve]"
]
}
]
}
},
options: {
grid: {
type: "classic",
showTotals: "off"
}
}
},
width: "100%",
height: 370
});
function getData() {
return [
{
"Person":"Bob",
"Visited Place": "London",
"On Date": "5/1/2010",
"Transport Charges": 10.05
},
{
"Person":"Bob",
"Visited Place": "London",
"On Date": "5/1/2010",
"Transport Charges": 5.05
},
{
"Person":"Bob",
"Visited Place": "Las Vegas",
"On Date": "4/20/2008",
"Transport Charges": 8.99
},
{
"Person":"Bob",
"Visited Place": "Las Vegas",
"On Date": "4/20/2008",
"Transport Charges": 8.99
},
{
"Person":"Bob",
"Visited Place": "Sydney",
"On Date": "7/6/1995",
"Transport Charges": 8.45
},
{
"Person":"Steve",
"Visited Place": "London",
"On Date": "6/4/1982",
"Transport Charges": 10
...