Data types in JSON
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",
dimensionUniqueName: "Position"
},
"Country": {
type: "level",
hierarchy: "Geography",
level: "Country"
},
"State": {
type: "level",
hierarchy: "Geography",
level: "State",
parent: "Country"
},
"City": {
type: "level",
hierarchy: "Geography",
parent: "State"
},
"Hemisphere": {
type: "string",
dimensionUniqueName: "Position"
},
"Price": {
type: "number"
},
"Quantity": {
type: "number"
}
},
{
"Color": "green",
"Country": "Canada",
"State": "Ontario",
"City": "Toronto",
"Hemisphere": "North",
"Price": 174,
"Quantity": 22
},
{
"Color": "red",
"Country": "USA",
"State": "California",
"City": "Los Angeles",
"Hemisphere": "North",
"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: "Geography"
}],
measures: [{
uniqueName: "Price",
aggregation: "sum"
}]
}
}
});