Flexmonster Demo - Ragged Hierarchy and Date Hierarchy
by Iryna Kulchytska
HTML
<script src="https://s3.amazonaws.com/flexmonster/2.2/flexmonster.js"></script>
<div id="pivot-content"></div>
JavaScript
var jsondata = [{
"Color": {"type": "string"},
"Date": {"type":"year/month/day"},
"country": {"type": "level", "hierarchy": "Geography", "level": "Country"},
"state": {"type": "level", "hierarchy": "Geography", "level": "State", "parent": "Country"},
"city": {"type": "level", "hierarchy": "Geography", "parent": "State"},
"Price": {"type": "number"},
"Quantity": {"type": "number"}
},
{
"Color" : "red",
"Date": "2016-04-18",
"country" : "France",
"Price" : 166,
"Quantity" : 19
},
{
"Color" : "red",
"Date": "2016-04-10",
"country" : "USA",
"state" : "Texas",
"Price" : 166,
"Quantity" : 19
},
{
"Color" : "green",
"Date": "2016-05-29",
"country" : "Canada",
"state" : "Ontario",
"city" : "Toronto",
"Price" : 174,
"Quantity" : 22
},
{
"Color" : "red",
"Date": "2016-03-20",
"country" : "USA",
"state" : "California",
"city" : "Los Angeles",
"Price" : 166,
"Quantity" : 19
}
];
var report = {
dataSourceType: "json",
data: jsondata,
configuratorActive: false,
rows: [
{ uniqueName: "Geography" },
{ uniqueName: "[Measures]" }
],
columns: [
{ uniqueName: "Date" }
],
measures: [
{ uniqueName: "Price", aggregation: "sum" }
]
};
report.licenseKey = "Z53G-1T1WC3-1V1M-0L12-2M0A-1233-1I0Y-2Y2Q-1903-322S-0T2C-1I";
flexmonster.embedPivotComponent("https://s3.amazonaws.com/flexmonster/2.2/", "pivot-content", "100%", "600", report, true);