Define weekday type in JSON data

Mapping configuration

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/",
  width: "100%",
  height: 430,
  toolbar: true,
  report: {
    dataSource: {
      dataSourceType: "json",
      data: getData(),
      mapping: {
        "L4L": {
          type: "string"
        },
        "Country": {
          type: "string"
        },
        "Store": {
          type: "string"
        },
        "Day of Week": {
          type: "weekday"
        },
        "CS": {
          type: "number"
        },
        "CS NET": {
          type: "number"
        }
      }
    },
    slice: {
      rows: [{
        uniqueName: "Day of Week"
      }],
      columns: [{
          uniqueName: "L4L",
          sortOrder: ["Existing", "New", "Closed"]
        },
        {
          uniqueName: "[Measures]"
        }
      ],
      measures: [{
        uniqueName: "CS"
      }]
    }
  }
});

function getData() {
  return [{
    "L4L": "Existing",
    "Country": "Germany",
    "Store": "store C",
    "Day of Week": "Wednesday",
    "CS": 1,
    "CS NET": 1
  }, {
    "L4L": "New",
    "Country": "Germany",
    "Store": "store A",
    "Day of Week": "Wednesday",
    "CS": 1,
    "CS NET": 1
  }, {
    "L4L": "Existing",
    "Country": "Germany",
    "Store": "store C",
    "Day of Week": "Monday",
    "CS": 1,
    "CS NET": 1
  }, {
    "L4L": "New",
    "Country": "Germany",
    "Store": "store A",
    "Day of Week": "Tuesday",
    "CS": 1,
    "CS NET": 1
  }, {
    "L4L": "Existing",
    "Country": "Germany",
    "Store": "store B",
    "Day of Week": "Thursday",
    "CS": 1,
    "CS NET": 1
  }, {
    "L4L": "Closed",
    "Country": "Germany",
    "Store": "store A",
    "Day of Week": "Sunday",
    "CS": 1,
    "CS NET": 1
  }, {
    "L4L": "Existing",
    "Country": "Germany",
    "Store": "store A",
    "Day of Week": "Saturday",
    "CS":...