I have an odata list for example in JSON notation:
var data = [
{"category" : "A", "value" : 1, "group" : "x"},
{"category" : "B", "value" : 2, "group" : "y"},
{"category" : "C", "value" : 3, "group" : "x"},
{"category" : "A", "value" : 4, "group" : "y"},
{"category" : "A", "value" : 5, "group" : "x"}
];
First of all I filter against group == x; Values left are:
var data = [
{"category" : "A", "value" : 1, "group" : "x"},
{"category" : "C", "value" : 3, "group" : "x"},
{"category" : "A", "value" : 5, "group" : "x"}
];
Now I would group (at client side) by category and sum up the values, so the result should be:
var data = [
{"category" : "A", "value" : 6, },
{"category" : "C", "value" : 3, },
];
After that I would bind the model to some SAPUI5 control.
But the grouping part seems not possible.
Does someone know a generic solution for that problem?
A potential use case:
var oDataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions : [ {axis : 1, value : "{category}", name : "Category" } ],
measures : [ {value : "{value}", name : "Value" } ],
data : {
path : "/Data"
}
});
var oGraph = new sap.viz.ui5.Donut({
dataset : oDataset, // sap.viz.ui5.data.Dataset
});