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>
<button onclick="update()">
update
</button>
<div id="pivot-container">The component will appear here</div>
JavaScript
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
height: 300,
report: {
tableSizes: {
"columns": [{
"idx": 0,
"width": 160
},
{
"tuple": ["country.[germany]"],
"measure": {
"uniqueName": "Price",
"aggregation": "sum"
},
"width": 160,
}
],
"rows": [{
"tuple": ["category.[cars]"],
"height": 80
}]
},
dataSource: {
filename: "data/data.csv"
},
slice: {
rows: [{
uniqueName: "Category"
}],
columns: [{
uniqueName: "Country",
filter: {
exclude: [
"country.[canada]",
"country.[united kingdom]"
]
}
},
{
uniqueName: "[Measures]"
}
],
measures: [{
uniqueName: "Price",
aggregation: "sum"
}]
},
}
});
function update(){
pivot.updateData({
type: 'csv',
filename: 'data/data.csv?'+Math.random() //Added Math.random so that the data source's filename is changed and actually reloaded
});
}