Skip to Content
avatar image
Former Member

How to display percentage in list card - bar flavor in Fiori Overview Page

How to display percentage in list card - bar flavor in Fiori Overview page like this:

there is lines of code in AnnotationHelper.js:

sap.ovp.cards.AnnotationHelper.isFirstDataPointPercentageUnit = function(iContext, aCollection) {
		var oDataPoint = getSortedDataPoints(iContext, aCollection)[0];


		if (oDataPoint && oDataPoint.Value && oDataPoint.Value.Path) {
			var sEntityTypePath = iContext.getPath().substr(0, iContext.getPath().lastIndexOf("/") + 1);
			var oModel = iContext.getModel();
			var oEntityType = oModel.getProperty(sEntityTypePath);
			var oProperty = oModel.getODataProperty(oEntityType, oDataPoint.Value.Path);
			if (oProperty && oProperty["Org.OData.Measures.V1.Unit"]) {
				return oProperty["Org.OData.Measures.V1.Unit"].String === "%";
			}
		}
		return false;
	};

Seems it determines the "Org.OData.Measures.V1.Unit" then set the Min and Max value of the bar. But how can I set the Unit property of the data field in odata metadata.xml?

Or if there is another way to make the datapoint as a percentage value?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Oct 26, 2017 at 11:16 AM

    After investigation, should add unit annotations to specific data column:

    <Annotations Target="NAME_SPACE.ENTITY_TYPE/PROPERTY_NAME">
        <Annotation Term="Org.OData.Measures.V1.Unit" String="%"/>
    </Annotations>
    
    Add comment
    10|10000 characters needed characters exceeded