JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<script src="https://cdn.flexmonster.com/lib/flexmonster.googlecharts.js"></script>
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="pivot-container"></div>
JavaScript
let pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
licenseFilePath: "https://cdn.flexmonster.com/jsfiddle.charts.key",
toolbar: false,
height: "600px",
report: {
dataSource: {
type: "json",
filename: "data/retail-data.json"
},
slice: {
rows: [{
uniqueName: "Date.Month",
sortOrder: [
"january",
"february",
"march",
"april",
"may",
"june",
"july",
"august",
"september",
"october",
"november",
"december"
]
},
{
uniqueName: "Date.Year"
}
],
columns: [{
uniqueName: "Country",
filter: {
members: [
"country.[switzerland]",
"country.[uk]",
"country.[ukraine]",
"country.[usa]",
"country.[sweden]",
"country.[poland]"
]
}
},
{
uniqueName: "[Measures]"
}
],
measures: [{
uniqueName: "Price",
aggregation: "percentofrow",
format: "-g2bl4mxltx200"
}],
expands: {
expandAll: true
},
drills: {
drillAll: true
}
},
options: {
viewType: "charts",
chart: {
type: "stacked_column",
title: "FY 2018 VS FY 2019"
}
},
formats: [{
name: "-g2bl4mxltx200",
decimalPlaces: 2
}],
},
reportcomplete: function() {
pivot.off("reportcomplete");
pivot.expandAllData();
}
});