Custom decoration

by bacsacosta

HTML

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

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

JavaScript

new Flexmonster({
  container: "#pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  height: "400",
  toolbar: true,
  report: {
    dataSource: {
      dataSourceType: "json",
      data: getData()
    },
    "slice": {
      "rows": [{
        "uniqueName": "Item Id"
      }],
      "columns": [{
        "uniqueName": "[Measures]"
      }],
      "measures": [{
          "uniqueName": "Quantity",
          "aggregation": "sum"
        },
        {
          "uniqueName": "Price",
          "aggregation": "sum"
        },
        {
          "uniqueName": "Discount",
          "aggregation": "sum"
        }
      ]
    },
    "options": {
      "grid": {
        "showTotals": "off",
        "showGrandTotals": "off"
      }
    },
    "conditions": [{
      "formula": "#value > 10000",
      "measure": "Quantity",
      "format": {
        "backgroundColor": "#8BC34A",
        "color": "#000000",
        "fontFamily": "Arial",
        "fontSize": "12px"
      }
    }]
  }
});

function getData() {
  return [{
      "Item Id": {
        type: "string"
      },
      "Item Desc": {
        type: "property",
        hierarchy: "Item Id"
      },
      "Store Id": {
        type: "string"
      },
      "Store Desc": {
        type: "property",
        hierarchy: "Store Id"
      },
      "Price": {
        type: "number"
      },
      "Quantity": {
        type: "number"
      },
      "Discount": {
        type: "number"
      },
      "Date": {
        type: "date string"
      }
    }, {
      "Item Id": "ITM01",
      "Item Desc": "Desc. Item 01",
      "Store Id": "STR02",
      "Store Desc": "Desc. Store 02",
      "Price": 174,
      "Quantity": 225,
      "Discount": 23,
      "Date": "2011-01-12"
    },
    {
      "Item Id": "ITM01",
      "Item Desc": "Desc. Item 01",
      "Store Id": "STR02",
      "Store Desc": "Desc. Store 02",
      "Price": 502,
      "Quantity": 90,
      "Discount": 17,
      "Date":...