JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="setFormat()">Change currency symbol</button>
<div id="pivot-container"></div>
JavaScript
let pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 600,
toolbar: true,
report: {
"dataSource": {
"type": "microsoft analysis services",
"proxyUrl": "https://olap.flexmonster.com:8085/",
"catalog": "Adventure Works DW Standard Edition",
"cube": "Adventure Works",
"binary": true
},
"slice": {
"rows": [{
"uniqueName": "[Product].[Product Categories]"
}],
"columns": [{
"uniqueName": "[Customer].[Country]"
},
{
"uniqueName": "[Date].[Month of Year]",
"caption": "Month"
},
{
"uniqueName": "[Measures]"
}
],
"measures": [{
"uniqueName": "[Measures].[Internet Total Product Cost]"
}
],
},
"options": {
"showMemberProperties": true
},
}
});
var formatCurrency = {
name: "currency",
thousandsSeparator: ",",
decimalSeparator: ".",
decimalPlaces: 2,
maxDecimalPlaces: 2,
maxSymbols: 20,
negativeNumberFormat: "-1",
currencySymbol: "$",
negativeCurrencyFormat: "-$1",
positiveCurrencyFormat: "$1",
isPercent: false,
nullValue: "",
infinityValue: "Infinity",
divideByZeroValue: "Infinity",
textAlign: "right",
beautifyFloatingPoint: true
};
function setFormat() {
flexmonster.setFormat(formatCurrency, "[Measures].[Internet Total Product Cost]");
flexmonster.refresh();
}