Number formatting example

Number formatting

by Flexmonster Pivot Table

HTML

<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<div id="pivot-container"></div>

CSS

@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);

JavaScript

let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    dataSource: {
      filename: "data/data.csv"
    },
    slice: {
      rows: [{
        uniqueName: "Color"
      }],
      columns: [{
        uniqueName: "[Measures]"
      }],
      measures: [{
        uniqueName: "Price",
        format: "currency"
      }, {
        uniqueName: "Quantity"
      }]
    },
    formats: [{
        name: "", // for all measures
        decimalSeparator: ",",
        thousandsSeparator: " ",
        currencySymbol: "",
        decimalPlaces: 0
      },
      {
        name: "currency", // for measures with format = "currency"
        decimalSeparator: ",",
        thousandsSeparator: " ",
        currencySymbol: "$",
        decimalPlaces: 2
      }
    ]
  }
});