Skip to Content
0
Jul 26, 2019 at 10:12 AM

Viz charts gives error: [50017] - Invalid data binding

81 Views

Hi,

I am trying to create a viz chart with a local JSON model, I use a random strucutre generated, but I am unable to visualize the chart, the array is being filled properly.

[50017] - Invalid data binding

		onInit: function () {
			this.buildJSON();
			this.buildDataSet();
		},
		buildJSON: function () {
			var data = {};
			for (var i = 0; i < 500; i++) {
				data.mess = this.getRandomInt(100);
				data.count = this.getRandomInt(200);
				data.fix1 = this.getRandomInt(5000);
				data.fix2 = this.getRandomInt(9000);
				data.fix3 = this.getRandomInt(5000);
				dataArr.push(data);
				data = {};
			}
		},
		buildDataSet: function () {
			var dataset = new FlattenedDataset();
			var datasetData = new sap.ui.model.json.JSONModel(dataArr);
			this.getOwnerComponent().setModel(datasetData, "datasetData");
			dataset.bindData("datasetData>/",null,null,[]);
			var measure = new MeasureDefinition();
			measure.setName("fix1");
			measure.setValue("datasetData>fix1");
			dataset.addMeasure(measure);
			var measure2 = new MeasureDefinition();
			measure2.setName("fix2");
			measure2.setValue("datasetData>fix2");
			dataset.addMeasure(measure2);
			var dimension = new DimensionDefinition();
			dimension.setName("mess");
			dimension.setValue("datasetData>mess");
			dataset.addDimension(dimension);
			this.byId("idVizFrame").setModel(datasetData);
			this.byId("idVizFrame").setDataset(dataset);
		},
		getRandomInt: function (max) {
			return Math.floor(Math.random() * Math.floor(max));
		}

the HTML view for the viz chart is declared as follows:

	<viz:VizFrame id="idVizFrame" uiConfig="{applicationSet:'fiori'}" height='100%' width="100%" vizType='column'></viz:VizFrame>

Please assist.