Hi All,
I am trying to create a Donut chart of this Kind in XML views , but it says NO DATA , Probably i am not binding the JSON model properly to the graph.
Please help !
onInit Method in my Controller.
onInit: function() { var oBusinessData = [{ Country : "120-350", revenue : 487.66, profit : 100, population : 65350000 }, { Country : ">350", revenue : 470.23, profit : 500, population : 81799600 }, { Country : "0-120", revenue : 905.08, profit : 450, population : 313490000 } ]; oModel = new sap.ui.model.json.JSONModel(oBusinessData); console.log(oModel); },
XML View
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="example.donut" xmlns:html="http://www.w3.org/1999/xhtml"> <Page title="Donut Chart"> <content> <ui5.Donut xmlns="sap.viz" id="idonut" width="640px" height="480px"> <dataset> <ui5.data.FlattenedDataset xmlns="sap.viz"> <dimensions> <ui5.data.DimensionDefinition xmlns="sap.viz" axis="1" value="{Country}" name="Usage Low to High"> </ui5.data.DimensionDefinition> </dimensions> <measures> sap.viz.ui5.data.MeasureDefinition <ui5.data.MeasureDefinition xmlns="sap.viz" value="{profit}" name="£ 120"> </ui5.data.MeasureDefinition> </measures> <data path="/"> </data> </ui5.data.FlattenedDataset> </dataset> </ui5.Donut> </content> </Page></core:View>
output:
Many Thanks
Pandu