JSFiddle - React, Tailwind, and code Playground
Data source
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>
CSS
@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);
JavaScript
new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 600,
toolbar: true,
report: {
dataSource: {
type: "elasticsearch",
node: "https://olap.flexmonster.com:9200",
index: "fm-product-sales",
// FIlter: contains "Co" OR containt "Bi"
subquery: {
bool: {
should: [
{
wildcard: {
"Category.keyword": "*Co*",
},
},
{
wildcard: {
"Category.keyword": "*Bi*",
},
},
],
},
},
mapping: {
"Category.keyword": {
//Set as false to disable Flexmonster's default filters on top of subquery
filters: true
},
"@timestamp": {
visible: false,
},
"@version": {
visible: false,
},
host: {
visible: false,
},
message: {
visible: false,
},
path: {
visible: false,
},
},
},
slice: {
rows: [
{
uniqueName: "Category.keyword",
caption: "Category",
},
],
columns: [
{
uniqueName: "Color.keyword",
caption: "Color",
},
{
uniqueName: "[Measures]",
},
],
measures: [
{
uniqueName: "Price",
aggregation: "sum",
caption: "Price",
},
],
},
},
})