57
Views
2
Comments
Solved
[OutSystems Charts] Percentage value displayed on each slice in Donut Chart
Question
outsystems-charts
Reactive icon
Forge asset by OutSystems

Hi everyone,I would like to ask if some of you could help me display some data on a donut chart. I'm taking the (dynamic) data from an Aggregate, and I need to:

  • Ensure that the percentage value displayed on each slice represents a portion of 100%. In other words, the sum of all the values should equal 100%.

Right now, I have the values in percentages, but they aren't correct because they are just the value + "%".How should I calculate the correct percentage? Or, better yet, how should I write the calculation? I have attached a screenshot below for a better understanding of the issue.

Many thanks in advance.

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Hello @Sabrina Fiore 

First of all, for future notice, to make the collaboration with the community more efficient always try to share a sample oml with what you've tried so far.

For your use case, the right way to do it should be to calculate the percentages on your data source and those percentages should be the ones to be displayed.

Example:

Then you could use "Tooltip" to show the percentages directly on the Donut Chart to be rendered when you hover it:

in runtime:


Hope it helps!

Cheers,
GM

2020-07-21 19-28-50
Rajat Agrawal
Champion

Hi @Sabrina Fiore ,

Just for example take 3 test values in % 

like : 10 , 20 and 30 

Using these test value below is the calculation:

where 60 is sum of all values:

(1) for 10  

    (100/(60))*10 --- 16.66% 

(2)for 20

   (100/(60))*20 -----33.33%

(3)for 30

   (100/(60))*30 ----- 50%

In outsystems you simply create a calculate attribute in aggregate apply above calculation. 


Regards,

Rajat

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Hello @Sabrina Fiore 

First of all, for future notice, to make the collaboration with the community more efficient always try to share a sample oml with what you've tried so far.

For your use case, the right way to do it should be to calculate the percentages on your data source and those percentages should be the ones to be displayed.

Example:

Then you could use "Tooltip" to show the percentages directly on the Donut Chart to be rendered when you hover it:

in runtime:


Hope it helps!

Cheers,
GM

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.