Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Jens1983
Regular Visitor

SVG Images are not shown correctly

Hi everybody,

 

i am trying to implement svg graphics into my table. I followed different tutorials on youtube and i experience always the same problem. The SVG Image is shown incorrectly, it looks like that it is cut off, even if i labeled the meassure as image and played around with the imag size, which doesnt have any effect.

 

For example I tried to implement a star, using this code:

 

Stars = "data&colon;image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewbox='0 0 100 100'>

<path d='m50,2 12,34h361-28,22 10,34-30-20-30,20 10-34-28-22h36z'/>

</svg>"

 

and the outcome looks like this:

 

error.PNG

1 ACCEPTED SOLUTION

@Jens1983 What do you mean by "image symbol"? Can you share a screen shot? Remember, you need to replace the &colon; with an actual colon ( : ) for the SVG to work. It gets HTML encoded for whatever reason when pasting on this forum.

 

It should be classified as an image URL. What visual are you using it in? Below is with a standard Table visual. I am not aware of any Preview feature or anything else that should impact the display of SVG measures but will double check.

Greg_Deckler_1-1727445175578.png

 

Greg_Deckler_0-1727444853874.png

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

8 REPLIES 8
Greg_Deckler
Super User
Super User

@Jens1983 I'm not super familiar with the path function. This works though:

Stars = "data&colon;image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'>
<polygon points=""10,0 12,9 20,8 13,13 16,20 10,15 4,20 7,13 0,9 8,9"" style=""fill:red;stroke:red;stroke-width:0;fill-rule:evenodd;"" />
</svg>"

Comes from here: SVG Color Star Rating - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg, thanks for the solution but when I use your code, it only shows an image symbol, even when i classify it as an image-url 😞

@Jens1983 What do you mean by "image symbol"? Can you share a screen shot? Remember, you need to replace the &colon; with an actual colon ( : ) for the SVG to work. It gets HTML encoded for whatever reason when pasting on this forum.

 

It should be classified as an image URL. What visual are you using it in? Below is with a standard Table visual. I am not aware of any Preview feature or anything else that should impact the display of SVG measures but will double check.

Greg_Deckler_1-1727445175578.png

 

Greg_Deckler_0-1727444853874.png

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

This works, thanks for your help 🙂

Hi @Jens1983 ,

 

I suggest you to try this code.

vrzhoumsft_0-1727660696765.png

Result is as below.

vrzhoumsft_0-1727428867751.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Still doesnt work, it shows only an image symbol, even if i label it as an image-url 😞

Hi @Jens1983 ,

 

I think there may be something wrong when we copy the code and paste it in website.

I update the my reply with screenshot, it should be date:image... instead of data&colon... .

Please download my sample file and have a test.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for your help, your solution also works fine for me 🙂

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.