Update only some part of JSON data without cleaning the report
Data source
HTML
<link rel="stylesheet" href="https://cdn.flexmonster.com/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div>
<h2>How to update only some part of JSON data without cleaning the report</h2>
<p>
The <a href="https://www.flexmonster.com/api/updatedata/" target="_blank">updateData()</a> method allows updating the data whereas other report configurations are not changed.
</p>
<p>
For JSON, <code>updateData()</code> supports partial data update. This example shows how to add, edit, and delete records in your dataset.
</p>
<p>
<a href="https://www.flexmonster.com/api/updatedata/#!example-4" target="_blank">Visit our docs to learn more about partial data update</a>.
</p>
</div>
<div id="pivot-container"></div>
CSS
h2 {
text-align: center;
}
p {
font-size: 15px;
line-height: 1.5;
padding-right: 10px;
padding-left: 10px;
}
a {
color: #00a45a;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
code {
font-size: 105%;
color: #DF3800;
background-color: #f5f5f5;
padding: 1px 4px;
font-family: monospace !important;
border-radius: 4px;
}
JavaScript
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 430,
report: {
dataSource: {
data: getData()
},
"slice": {
"rows": [{
"uniqueName": "symbol"
},
{
"uniqueName": "UL"
}
],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Qty",
"aggregation": "sum"
},
{
"uniqueName": "Net PnL",
"aggregation": "sum"
},
{
"uniqueName": "Cumul Pnl",
"aggregation": "sum"
},
{
"uniqueName": "Trade PnL",
"aggregation": "sum"
},
{
"uniqueName": "price",
"aggregation": "sum"
},
{
"uniqueName": "delta",
"aggregation": "sum"
},
{
"uniqueName": "gamma",
"aggregation": "sum"
},
{
"uniqueName": "Dollar Delta",
"aggregation": "sum"
},
{
"uniqueName": "Dollar Gamma",
"aggregation": "sum"
},
{
"uniqueName": "vega",
"aggregation": "sum"
},
{
"uniqueName": "Weighted Vega",
"aggregation": "sum"
},
{
"uniqueName": "VIX Vega",
"aggregation": "sum"
},
{
"uniqueName": "theta",
"aggregation": "sum"
},
{
"uniqueName": "vanna",
"aggregation": "sum"
},
{
"uniqueName": "volga",
"aggregation": "sum"
},
{
"uniqueName": "Vol",
"aggregation": "average"
},
{
"uniqueName": "YDay Vol",
"aggregation": "average"
},
]
},
}
});
function getData() {
return [{
"symbol": "SPX 2021-12-17 FUT",
...