JSFiddle - React, Tailwind, and code Playground
by Karthickc
HTML
<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/",
toolbar: true,
report: {
dataSource: {
data: getData()
},
slice: {
rows: [{
uniqueName: "name"
}],
columns: [{
uniqueName: "[Measures]"
}],
measures: [
{
"uniqueName": "value_percent",
"aggregation": "sum",
"format": "percent"
},
{
"uniqueName": "Formula #1",
"formula": "sum(\"value_percent\") * 100",
"caption": "Formula #1",
"format": "percentWorkaround",
}
]
}
}
});
function getData() {
return [{
"name": "1",
"value_percent": 14,
},
{
"name": "2",
"value_percent": 45,
},
{
"name": "3",
"value_percent": 0
}
]
}