Skip to Content
0
Jan 12, 2016 at 06:27 AM

binding pie chart with odata

370 Views

Hello,

i have created a pie chart in controller.js, but i am unable to display data on it using odataModel.

Below is the code:

============

var url1 = "/LV_PIESet?$filter=IvEflag eq 'M' and IvFromDate eq datetime'2015-01-01T00:00:00' and IvToDate eq datetime'2016-12-31T00:00:00'";

oDataModel.read(url1, null, null, false, function(

oData, oResponse) {

debugger;

arr = oData;

a1 = arr.results;

});

pieChartModel = new sap.ui.model.json.JSONModel(

a1);

this.getView().setModel(pieChartModel);

sap.ui.getCore().setModel(pieChartModel, "pieChart");

var dataset = new sap.viz.ui5.data.FlattenedDataset({

dimensions : [ {

axis : 1,

name : 'Status',

value : "{Status}",

} ],

measures : [ {

name : 'Total Emp',

value : "{Scount}",

} ],

data : {

path : "/oData"

}

});

pie = new sap.viz.ui5.Pie({

id : "displaypie",

width : "56%",

height : "350px",

selectData : function(oEvent) {

that.funSelectData(oEvent);

},

bar : {

},

======================

Here is the snapshot of odata in chrome debugger:

Can someone please point out the mistake or addition that has to be done in order to display data on pie chart.

thanks,

Saurabh.

Attachments

odata pie.JPG (16.1 kB)