cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Defining a threshold for Other in Donut Chart (Fiori Elements)

kchatch1
Explorer
0 Kudos
1,185

Hello,

I am wondering how to define the Other category for a donut chart in the CDS view. I have seen this in screenshots where they have a count in () next to the Other category. This would capture everything below a certain threshold (for example, in my case, a value below '2' would be grouped in the Other category. If 10 entries met this criteria, it would say Other(10) and if a value of 1 was out of a total of 20, these 10 entries would make up 50% of the pie chart. Is this calculated in the CDS view somehow? I haven't been able to find anything, or even find an app in the launchpad that does this.

Please provide code example / annotation example for the CDS view. I've done my due diligence trying to find this answer on my own.

Thanks,

Kevin

My Current Code:

@UI.chart: [{

qualifier: 'F1',

title: 'Tiles usage view',

chartType: #DONUT,

dimensions: ['tile'],

measures: ['total_hits'],

dimensionAttributes: [{ dimension: 'tile', role: #CATEGORY }],

measureAttributes: [{ measure: 'total_hits', role: #AXIS_1, asDataPoint: true }]

}]

@UI.dataPoint:{

title: 'Total Hits',

criticalityCalculation:{

improvementDirection: #TARGET,

deviationRangeHighValue: 10, // 2000 Just Playing around with some numbers here...

toleranceRangeLowValue: 2 // 50 Just Playing around with some numbers here...

}

}

@EndUserText.label: 'Total Hits'

@UI.lineItem: [{position: 20, label: 'Total Hits', qualifier: 'F1', type: #AS_DATAPOINT}]

sum(hits) as total_hits,

Accepted Solutions (1)

Accepted Solutions (1)

kchatch1
Explorer
0 Kudos

So the answer is that there isn't anything on the card properties in the manifest that automatically creates an Other(XX) category. And the CDS view / annotations don't offer any kind of threshold aggregation either that I know of. Please correct me if I'm wrong. You're going to need to do that yourself using a few CDS view entities... for example, something like this aggregates into an Other category data that only consists of one unique key combination:

tfranziszit
Explorer
0 Kudos

No, this suggested answer of kchatch1 is not true...
Fiori is doing this automatically if you configure it correctly. With responsive cards it also depends on the size of the card.
You have to have to implement the donut chart like this with Dimension as #CATEGORY + you need a presentation variant:

tfranziszit_0-1732130904460.png

tfranziszit_1-1732130923086.png

tfranziszit_3-1732130945806.png

The only strange thing is that the value you give does not fit to the count which is displayed. When I put 1, it displays 2 + Others. When i put 3 it displays 4 + Others. Maybe this is because of the responsivness of the cards. But besides this it works fine.
PS: Don't forget to include the Presentation Variant into your manifest.json

BR Tobi

 

 

 

 
 

 

 

Answers (0)