web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

Donut char via SVG

(0) ShareShare
ReportReport
Posted on by 290

Hey!

 

I am trying to display a vacation value via donut char, which is SVG.

The code is: 

"data:image/svg+xml," & EncodeUrl(
 "<svg width='100%' height='100%' viewBox='0 0 42 42' class='donut' xmlns='http://www.w3.org/2000/svg'>
 <circle class='donut-hole' cx='21' cy='21' r='15.91549430918954' fill='#fff'></circle>
 <circle class='donut-ring' cx='21' cy='21' r='15.91549430918954' fill='transparent' stroke='#ce4b99' stroke-width='3'></circle>
 <circle class='donut-segment' cx='21' cy='21' r='15.91549430918954' fill='transparent' stroke='#d2d3d4' stroke-width='3' stroke-dasharray='" & (ThisItem.VacationValue) & "' stroke-dashoffset='25'></circle>
</svg>"
)

And it should display a value of VacationValue column inside the donut char/150 (so its how many vacation you still have out of 150. But this code displays just displays random donut chars. Also it should dynamically change the overlay. 

 

Video example with time: https://youtu.be/S-YUearXrBA?t=310

 

Could someone help?

Categories:
I have the same question (0)
  • timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    Hi @Filistyn 

    For the stroke-dasharray value of your donut-segment, you need 2 values that add up to 100%.

     

    Let's say ThisItem.VacationValue is 50 (eg 50 vacation days out of 150 days), this would be 33% so stroke-dasharray would need to be '33 66'.

     

    The calculation to derive 33% would be this - (50/150) * 100. Therefore, the formula you would use would look like this:

     

    With({segmentPercentage:(ThisItem.VacationValue/150) * 100}, 
     "data&colon;image/svg+xml," & EncodeUrl(
     "<svg width='100%' height='100%' viewBox='0 0 42 42' class='donut' xmlns='http://www.w3.org/2000/svg'>
     <circle class='donut-hole' cx='21' cy='21' r='15.91549430918954' fill='#fff'></circle>
     <circle class='donut-ring' cx='21' cy='21' r='15.91549430918954' fill='transparent' stroke='#ce4b99' stroke-width='3'></circle>
     <circle class='donut-segment' cx='21' cy='21' r='15.91549430918954' fill='transparent' stroke='#d2d3d4' stroke-width='3' stroke-dasharray='" & segmentPercentage & " " & 100-segmentPercentage & "' stroke-dashoffset='250'></circle>
    </svg>"
    )
    )

     

     

    timl_0-1630921572168.png

     

     

  • Filistyn Profile Picture
    290 on at

    Thank you for your answer. I have tried your code and the image has completely dissapeared 😞

  • timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    Hi @Filistyn 

    Unfortunately, the code editor here is HTML escaping the characters and replacing the colon character with &colon;

     

    In your formula, can you confirm that this line includes a colon character like so?

    "data&colon;image/svg+xml," & EncodeUrl(

  • Filistyn Profile Picture
    290 on at

    I can confirm

  • timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    @Filistyn 

    Can you confirm the value of ThisItem.VacationValue that doesn't work for you? If you hardcode a value of 50, for example, does the chart show like in my screenshot above?

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard