Skip to Content

Displaying data point in Donut chart as % in OVP Analytical Card

Can anyone guide me on how to display a datapoint in a Donut Chart in an Analytical Card as a percentage - 30% rather than as a value e.g. 10. This site shows the donut chart displaying the values as a percentage and it is what i'm trying to achieve TechEd17 example.

In the CDS view i have default aggregation for the value set as:

@DefaultAggregation: #SUM

I've tried adding a measure unit to the local annotations but this annotation only takes effect in the card header.

<Annotation Term="CQP.Unit" String="%"/>

I've downloaded the annotations and manifest files from the example website but there is nothing different in my local annotations / manifest.json.

Any help would be greatly appreciated.

percentage.png (146.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Jul 30, 2018 at 02:23 PM

    Hi Mark,

    I am working on a similar requirement.

    I am trying to display a donut chart from cds views annotations. donut-1.png

    But, I am unable to bind the values of KPI annotation path in Analytics Card of OVF page.

    Kindly guide me this.


    donut-1.png (28.1 kB)
    Add comment
    10|10000 characters needed characters exceeded

    • What does your oData service look like? Can you post the $metadata. Looking at your CDS view there is no @DefaultAggregation annotation. In my experience this causes issues as it causes none of the properties to have sap:aggregation-role set. Can you also post your annotations xml file for your OVP if you're adding them via Web IDE.

      Looking at some of my CDS views where we required a Count Distinct we approached it as below (where SalesContract was the field we required a Count Distinct on).

      @Aggregation.default: #COUNT_DISTINCT 
      
      @Aggregation.referenceElement: [SalesContract] 
      
      cast( 1 as abap.int4 ) as SalesContractCount 
  • Oct 05, 2018 at 07:02 PM

    Hi,

    the KPI Annotation Path references to a value, shown on top in the head area. Usually, the path is defined in "metadata.xml" like this:

    <EntityType Name="NeuRegistrierungen" sap:content-version="1">
    <Key>
    <PropertyRef Name="Keyval1"/>
    <PropertyRef Name="TimeHh"/>
    </Key>
    <Property Name="AnzRegNeu" Type="Edm.Int32" Nullable="false" sap:unicode="false" sap:label="neue Registrierung" sap:creatable="false"
    sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
    <Property Name="Zeitraum" Type="Edm.String" Nullable="false" MaxLength="2" sap:unicode="false" sap:label="Zeitraum" sap:creatable="false"
    sap:updatable="false" sap:sortable="false"/>
    <Property Name="AnzReg" Type="Edm.Int32" Nullable="false" sap:unicode="false" sap:label="Registrierung" sap:creatable="false"
    sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
    <Property Name="Keyval1" Type="Edm.String" Nullable="false" MaxLength="8" sap:unicode="false" sap:label="Zeitraum" sap:creatable="false"
    sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
    <Property Name="TimeHh" Type="Edm.String" Nullable="false" MaxLength="2" sap:unicode="false" sap:label="Uhrzeit Stunden"
    sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
    <Property Name="OVP-VerticalBulletChart_Value" Type="Edm.String" Nullable="true" sap:creatable="true" sap:updatable="true"
    sap:deletable="true" sap:label="OVP-VerticalBulletChart_Value"/>
    <Property Name="OVP-VerticalBulletChart_TrendCalculation_ReferenceValue" Type="Edm.String" Nullable="true" sap:creatable="true"
    sap:updatable="true" sap:deletable="true" sap:label="OVP-VerticalBulletChart_TrendCalculation_ReferenceValue"/>
    </EntityType>

    The metadata.xml will be generated when you connect to your odata service. And so far I've understood, the KPI path is referenced in every single entity.

    I have tried to create a card, but was also not able.

    Cengiz

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 29 at 04:19 AM

    My understanding to you query is to show a negative percentages/values on donut chart. If this is true, I believe this is not a supported scenario to pie/donut chart by nature.

    Differ from other axes charts like line/column which consist of origin (the zero line), pie/donut chart doesn't visualize values in quadrant but only by size of sectors so there is no origin to divide positive and negative values.That's said, pie/donut chart could only visible positive values.

    Add comment
    10|10000 characters needed characters exceeded

    • Thank you for your clarification.

      Chart property

      plotArea.dataLabel.type

      allows you to set color, value, percentage, colorAndPercentage. "color" here represents value of dimension being fed as "color" uid. You could try set this property to "value" in order to show the original value.