JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
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()
},
formats: [{
name: "percentWorkaround",
negativeNumberFormat: "(1)",
currencySymbol: "%",
negativeCurrencyFormat: "(1$)",
positiveCurrencyFormat: "1$",
},
{
name: "percent",
negativeNumberFormat: "(1)",
negativeCurrencyFormat: "(1$)",
positiveCurrencyFormat: "1$",
isPercent: true
}
],
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": "one",
"value_percent": -0.5,
},
{
"name": "two",
"value_percent": -0.67,
},
{
"name": "three",
"value_percent": -0.27
}
]
}