API call connectTo for connection to the data source
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>
<button onclick="connectJSON()">Connect to remote JSON</button>
<div id="pivot-container"></div>
JavaScript
var jsonData = [
{
"City" : "Toronto",
"Price" : 174
},
{
"City" : "Los Angeles",
"Price" : 166
}
];
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
report: {
dataSource: {
data: jsonData
},
"slice": {
"rows": [
{
"uniqueName": "City"
}
],
"columns": [
{
"uniqueName": "[Measures]"
}
],
"measures": [
{
"uniqueName": "Price",
"aggregation": "sum"
}
]
}
}
});
function connectJSON() {
flexmonster.connectTo({
filename: 'https://cdn.flexmonster.com/data/data.json'
});
}