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="pivotContainer"></div>
<div class="output" id="output">Output will appear here</div>
CSS
#pivotContainer .fm-drillthrough-view {
display: none !important;
}
.output {
width: 80%;
height: 300px;
margin-left: auto;
margin-right: auto;
padding: 20px;
background: rgba(242, 242, 242, 1);
font-family: Menlo, Monaco, "Courier New", Courier, monospace;
white-space: pre;
font-size: 16px;
font-weight: 400;
overflow-y: scroll;
margin-top: 20px;
}
JavaScript
let endpointUrl = "https://olap.flexmonster.com:9500/";
let index = "fm-product-sales";
let cache = {};
const fieldsResponse = {
"fields": [{
"uniqueName": "Category",
"type": "string"
},
{
"uniqueName": "Size",
"type": "string"
},
{
"uniqueName": "Color",
"type": "string"
},
{
"uniqueName": "Destination",
"type": "string"
},
{
"uniqueName": "Business Type",
"type": "string"
},
{
"uniqueName": "Country",
"type": "string"
},
{
"uniqueName": "Price",
"type": "number",
"aggregations": ["count"]
},
{
"uniqueName": "Quantity",
"type": "number"
},
{
"uniqueName": "Discount",
"type": "number"
}
],
"aggregations": {
"any": [
"count",
"distinctcount"
],
"date": [
"count",
"distinctcount",
"min",
"max"
],
"number": [
"sum",
"average",
"count",
"distinctcount",
"min",
"max"
]
},
"filters": {
"date": {
"members": true,
"query": [
"equal",
"not_equal",
"after",
"after_equal",
"before",
"before_equal",
"between",
"not_between",
"last",
"current",
"next"
],
"valueQuery": [
"top",
"bottom",
"equal",
"not_equal",
"greater",
"greater_equal",
"less",
"less_equal",
"between",
"not_between"
]
},
"number": {
"members": true,
"query": [
"equal",
"not_equal",
"greater",
"greater_equal",
"less",
"less_equal",
"between",
"not_between"
],
"valueQuery": [
"top",
"bottom",
"equal",
"not_equal",
"greater",
"greater_equal",
"less",
"less_equal",
...