on 10-26-2017 11:13 AM
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?
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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.