Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Pie chart

$
0
0

Hi All,

 

In one of the view, there is a pie chart. Not able to figure out why this chart is not getting displayed. Below is the code.

 

                  var aData = [ {
"Budget" : "Venue Budget",
"Expenses" : "40"
}, {
"Budget" : "Volunteer Budget",
"Expenses" : "30"
}, {
"Budget" : "Evaluator Budget",
"Expenses" : "20"
}, {
"Budget" : "Other Expenses",
"Expenses" : "10"
} ];

 

 

var oModel = new sap.ui.model.json.JSONModel();
oModel.setData({
lineData : aData
});

 

 

var oDataSet = new sap.viz.ui5.data.FlattenedDataset({
dimensions : [ {
name : "Budget",
axis : 1,
value : "{Budget}"
} ],
measures : [ {
name : "Expenses",
axis : 1,
value : "{Expenses}"
} ],
data : {
path : "/lineData"
}

 

 

});

 

 

var line = new sap.viz.ui5.Pie({

 

 

width : "800px",
height : "400px",
title : {
visible : true,
text : "Toatal Budget"
},
xAxis : {
title : {
visible : true,

 

 

}
},
yAxis : {
title : {
visible : true,

 

 

}
},
legend : {
visible : true,
title : {
visible : true,
}
},
plotArea : {
animation : {
dataLoading : false
}
},
interaction : {
pan : {
enable : false
}
},
dataset : oDataSet
});
line.setModel(oModel);
var fSelectionChanged = function(oEvent) {
var data = this.selection();
var Budget, Expenses;
var dataFilter = [];
for (i in data) {
Budget = data[i].data.Budget;
Expenses = data[i].data.Expenses;
dataFilter
.push(new sap.ui.model.Filter("Budget", "EQ", Budget));
dataFilter.push(new sap.ui.model.Filter("Expenses", "EQ",
Expenses));
}
};
line.attachSelectData(fSelectionChanged);
line.attachDeselectData(fSelectionChanged);
line.attachInitialized(function() {

});

return line;

 

It would be greater help, if anyone can correct me.

 

Thanks,

Ravikiran


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>