Flexmonster - Define weekday type in JSON data
by PavithraG
HTML
<script src="https://s3.amazonaws.com/flexmonster/2.2/flexmonster.js"></script>
<div id="pivot-content"></div>
JavaScript
flexmonster.embedPivotComponent("https://s3.amazonaws.com/flexmonster/2.2/", "pivot-content", "100%", "600", {
licenseKey: "Z53G-1T1WC3-1V1M-0L12-2M0A-1233-1I0Y-2Y2Q-1903-322S-0T2C-1I",
configuratorActive: false,
rows: [
{uniqueName: "Day of Week"}
],
columns: [
{uniqueName: "L4L", customSorting: ["Existing", "New", "Closed"]},
{uniqueName: "[Measures]"}
],
measures: [
{uniqueName: "CS"}
],
data: getData(),
localSettingsUrl: "https://s3.amazonaws.com/flexmonster/2.2/loc-en-workdays-order.xml"
}, true);
function getData() {
return [{
"L4L": { type: "string" },
"Country": { type: "string" },
"Store": { type: "string" },
"Day of Week": { type: "weekday" },
"CS": { type: "number" },
"CS NET": { type: "number" }
}, {
"L4L": "Existing",
"Country": "Germany",
"Store": "store C",
"Day of Week": "Wed",
"CS": 1,
"CS NET": 1
}, {
"L4L": "New",
"Country": "Germany",
"Store": "store A",
"Day of Week": "Wed",
"CS": 1,
"CS NET": 1
}, {
"L4L": "Existing",
"Country": "Germany",
"Store": "store C",
"Day of Week": "Mon",
"CS": 1,
"CS NET": 1
}, {
"L4L": "New",
"Country": "Germany",
"Store": "store A",
"Day of Week": "Tue",
"CS": 1,
"CS NET": 1
}, {
"L4L": "Existing",
"Country": "Germany",
"Store": "store B",
"Day of Week": "Thu",
"CS": 1,
"CS NET": 1
}, {
"L4L": "Closed",
"Country": "Germany",
"Store": "store A",
"Day of Week": "Sun",
"CS": 1,
"CS NET": 1
}, {
"L4L": "Existing",
"Country": "Germany",
"Store": "store A",
"Day of Week": "Sat",
"CS": 1,
"CS NET": 1
}, {
"L4L": "New",
"Country": "Germany",
"Store": "store A",
"Day of Week": "Wed",
"CS": 1,
"CS NET": 1
}, {
"L4L": "Existing",
"Country": "Germany",
"Store": "store A",
"Day of Week": "Fri",
"CS": 1,
"CS NET": 1
}];
}