Grouping fields under one folder
Data source
by Flexmonster Pivot Table
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>
JavaScript
var jsonDataWithTypes = [
{
"Color": {type: "string"},
"Country":{type: "string", dimensionUniqueName: "Geography"},
"State": {type: "string", dimensionUniqueName: "Geography"},
"City": {type: "string", dimensionUniqueName: "Geography"},
"Price": {type: "number"},
"Quantity": {type: "number"}
},
{
"Color" : "green",
"Country" : "Canada",
"State" : "Ontario",
"City" : "Toronto",
"Price" : 174,
"Quantity" : 22
},
{
"Color" : "red",
"Country" : "USA",
"State" : "California",
"City" : "Los Angeles",
"Price" : 166,
"Quantity" : 19
}
];
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
report: {
dataSource: {
data: jsonDataWithTypes
},
slice: {
rows: [
{ uniqueName: "Color" },
{ uniqueName: "[Measures]" }
],
columns: [
{ uniqueName: "Country" }
],
measures: [
{ uniqueName: "Price", aggregation: "sum" }
]
}
}
});