JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
June 23, 2020
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<h2 style="background-color: yellow;">
Try opening the drill-through and making sure no records with the price less than 1000 occur
</h2>
<div id="pivotContainer"></div>
CSS
h2 {
display: inline-block;
margin: 10px;
}
JavaScript
var pivot = new Flexmonster({
container: "pivotContainer",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
data: getData()
},
"slice": {
"reportFilters": [{
"uniqueName": "Price",
"filter": {
"query": {
"greater": 1000
}
}
}],
"rows": [{
"uniqueName": "Color"
}],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Price",
"aggregation": "sum"
}]
}
}
});
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",
"Country": "USA",
"State": "California",
"City": "Los Angeles",
"Price": 1664,
"Quantity": 19
},
{
"Color": "red",
"M": "January",
"W": "Mon",
"Country": "Canada",
"State": "Quebec",
"City": "Montreal",
"Price": 1190,
"Quantity": 292
},
{
"Color": "green",
"D": "04/08/2014",
"M": "August",
"W": "Fri",
"Country": "USA",
"State": "California",
"City": "Los Angeles",
"Price": 1222,
"Quantity": 730
},
{
"Color": "white",
"M": "March",
"W": "Wed",
"Country": "USA",
"State": "California",
"City": "Los Angeles",
"Price": 7941,
"Quantity": 73
},
{
"Color": "red",
"M": "August",
"W": "Wed",
"Country": "Canada",
"State": "Ontario",
"City": "Toronto",
"Price": 6829,
"Quantity": 19
},
{
"Color": "green",
"M": "January",
"W": "Wed",
"Country": "Canada",
"State": "Quebec",
"City": "Montreal",
"Price": 2995,
...