Skip to Content
avatar image
Former Member

SAPUI5 - Viz Bar chart only one measure

Hi,

I am using Vizframe for my bar chart. It is simple data coming from oData, basically containing only one row of data like this:

Item no. = 10

Ordered Qty = 1000

Planned = 2000

My controller code is this:

		var oDataset = new sap.viz.ui5.data.FlattenedDataset({
			dimensions: [{
				axis  : 1,
				name  : 'Posnr',
				value : '{Posnr}'}],
			measures : [{
				name : 'OrderedQty',
				value : '{OrderedQty}',
				name : 'PlannedProd',
				value : '{PlannedProd}'}],
			data : {
				path : "/d/results"
			}	
		});
		oVizFrame.setDataset(oDataset);
		oVizFrame.setModel(oModel);
		oVizFrame.setVizType('column');
		
		oVizFrame.setVizProperties({
			plotArea: {
			colorPalette : d3.scale.category20().range()
			}});
		
		var feedOrderedValues = new sap.viz.ui5.controls.common.feeds.FeedItem({
			'uid': "valueAxis",
			'type': "Measure",
			'values': ["OrderedQty"]
		});
		
		var feedPlannedValues = new sap.viz.ui5.controls.common.feeds.FeedItem({
			'uid': "valueAxis1",
			'type': "Measure",
			'values': ["PlannedProd"]
		});
		
		var	feedAxisLabels = new sap.viz.ui5.controls.common.feeds.FeedItem({
				'uid': "categoryAxis",
				'type': "Dimension",
				'values': ["Posnr"]
		});
		oVizFrame.addFeed(feedOrderedValues);
		oVizFrame.addFeed(feedPlannedValues);
		oVizFrame.addFeed(feedAxisLabels);  

When I have only one measure let's say Ordered Qty, the cart is displayed with the value for the quantity. When I add like above a second measure (Planned Qty), then I get an error, saying "Feed OrderedQty could not accept more data containers"

Any help is appreciated.

Thanks,

Tim

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 04 at 10:07 AM

    measures :[{name:'OrderedQty',value:'{OrderedQty}',name:'PlannedProd',value:'{PlannedProd}'}],

    Try rewrite the above line to the following:

    measures :[
    
      {name:'OrderedQty',value:'{OrderedQty}'},
    
      {name:'PlannedProd',value:'{PlannedProd}'}
    
    ],

    Please ensure OrderedQty and PlannedProd are exactly the name on the dataset from oDatasource.

    Add comment
    10|10000 characters needed characters exceeded