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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to scale the SVG image in matrix?

Hi! I'd be thankful for any help.

 

So I need to put my rectangular SVG image into my matrix as a column. For simplicity I have an example with the red rectangular. I use the following formula:

Example =
VAR MyText =
"data&colon;image/svg+xml;utf8, <svg width=""200"" height=""100"" viewBox=""0 0 100 100"" xmlns=""http://www.w3.org/2000/svg"" style=""background: red"">
</svg>"
RETURN MyText
 
And the result is the following
 

 

How can I force my red figure to scale and fill all the cell, which is of dark grey colour at the picture (at least by either height or width)? I tried to change parameters in my code or to play with Grid-Image height, but it didn't help. I cannot avoid those terrible gaps between rows while changing image height or a lot of free space inside my cell. Also I cannot get the logic behind its visual changing/not changing while I'm changing parameters in my code.
 
What am I doing wrong? Any tips here? 
 
 
3 REPLIES 3
Anonymous
Not applicable

example1.jpg

Hi @Anonymous,

SVG support within tables is a bit lacking. You only have control over a single apsect of the dimension for the container itself, which is specified in the properties under Grid Image Height. This will specify both the height and width of the containing div that the SVG gets rendered into, e.g.:

svg_scaling.gif

The GIF is a bit skippy but hopefully you can see that the cell pretty much remains square throughout.

The way to solve it is that we need a property to allow control of the image width as well as the height. There's an idea here for this feature, if you want to vote on it (I just did).

Not the answer you were after, I'm sure but hopefully clarifies what's possible right now.

Regards,

Daniel


If my post solves your challenge, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Anonymous
Not applicable

hi, Daniel! Thank you for the answer. It's so strange and abnormal, that some basic bugs are not being fixed for years, but more and more highly specialized features are added. Ugh, I'm so angry... How can I make a normal visualization, if I even have no option for vertical allignment inside matrix cell??!!... Some simple excel features are still absent... And this small bugs as the result destroy all the work I made for designing my report, cause my final user doesn't see my dax and table schemas, but asks to eliminate those gaps between rows... 

 

Dear Power Bi, facing such issues several times per day is so... disappointing. And I'm not the first person leaving such a comment, you know. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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