cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos

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?

Accepted Solutions (0)

Answers (1)

Answers (1)

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>