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>
CSS
.fm-header {
white-space: pre-wrap !important;
}
JavaScript
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 430,
toolbar: true,
report: {
dataSource: {
data: getData()
},
slice: {
pages: [{
uniqueName: "city"
}],
rows: [{
uniqueName: "Color"
}],
columns: [{
uniqueName: "[Measures]"
}],
measures: [{
uniqueName: "Price",
availableAggregations: ["average"],
active: false
}, {
uniqueName: "Quantity",
availableAggregations: ["average"]
}]
}
}
});
function getData() {
return [{
"Color": "green",
"M": "September",
"W": "Wed",
"country": "Canada",
"state": "Ontario",
"city": "Toronto",
"Price": 174,
"Quantity": 22
}, {
"Color": "red",
"M": "March",
"W": "Mon",
"Time": "1000",
"country": "USA",
"state": "California",
"city": "Los Angeles",
"Price": null,
"Quantity": 19
}];
}