API call setFormat for changing a currency symbol

Number formatting

by Dongor7

HTML

<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<button onclick="setFormat()">Change currency symbol</button>
<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()
    }
  }
});

function setFormat() {
  var format = flexmonster.getFormat("Price");
  format.name = "PriceFormat";
  format.currencySymbol = "$";
  //format.currencySymbol = "&#163;" // pound sterling
  //format.currencySymbol = "&#8364;" // euro
  //format.currencySymbol = "&#165;" // yen
  flexmonster.setFormat(format, "Price");
  flexmonster.refresh();
  
  //console.log(flexmonster.getData())
}

function getData() {
  return [{
    "Color": "green",
    "M": "September",
    "W": "Wed",
    "country": "Canada",
    "state": "Ontario",
    "city": "Toronto",
    "Price": 174,
    "Quantity": 22
  }, {
    "Color": "red",
    "M": "March",
    "W": "Mon",
    "Time": "1000",
    "country": "USA",
    "state": "California",
    "city": "Los Angeles",
    "Price": 30,
    "Quantity": 19
  }];
}