Number format for a specific measure
Number formatting
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
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 430,
toolbar: true,
report: {
dataSource: {
data: getData()
},
formats: [
{
name: "",
thousandsSeparator: ","
},
{
name: "currency",
currencySymbol: "$"
},
{
name: "amount",
decimalPlaces: 0,
currencySymbol: " pcs.",
currencySymbolAlign: "right"
}
],
slice: {
rows: [
{ uniqueName: "Category" }
],
measures: [
{
uniqueName: "Price",
aggregation: "sum",
active: true,
format: "currency"
},
{
uniqueName: "Discount",
aggregation: "sum",
active: false,
format: "currency"
},
{
uniqueName: "Quantity",
aggregation: "sum",
active: true,
format: "amount"
}
]
},
options: {
showAggregationLabels: false
}
}
});
function getData() {
return [
{
"Color": {type: "string"},
"M": {type: "string"},
"W": {type: "string"},
"Country":{type: "level", hierarchy: "Geography",
level: "Country"},
"State": {type: "level", hierarchy: "Geography",
level: "State", parent: "Country"},
"City": {type: "level", hierarchy: "Geography",
parent: "State"},
"Price": {type: "number"},
"Quantity": {type: "number"}
},
{
"Color": "green",
"M": "September",
"W": "Wed",
"country": "Canada",
"state": "Ontario",
"city": "Toronto",
"Price": null,
"Quantity": 22
},
{
"Color": "red",
"M": "March",
"W": "Mon",
"Time": "1000",
"country": "USA",
...