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>
JavaScript
let pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
licenseFilePath: "https://cdn.flexmonster.com/jsfiddle.charts.key",
report: {
dataSource: {
type: "csv",
filename: "data/data.csv"
},
options: {
grid: {
type: "flat"
},
configuratorActive: false
},
slice: {
columns: [{
uniqueName: "Country"
}, {
uniqueName: "Category"
}, {
uniqueName: "Color"
}, ]
}
},
width: 600,
height: 370
});
let cols = 0;
let gridWidth = 550;
let tableSizes = {};
let sizeArray = [];
flexmonster.on('reportcomplete', function() {
console.log(flexmonster.gridColumnCount());
cols = flexmonster.gridColumnCount();
for (i = 0; i <= cols; i++) {
sizeArray.push({
"idx": i,
"width": gridWidth / cols,
})
}
tableSizes.columns = sizeArray;
flexmonster.setTableSizes(tableSizes);
});