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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
WishAskedSooner
Continued Contributor
Continued Contributor

SVG scaling limit

Hi Experts!

 

There seems to be a size limit to how big an SVG will scale when loaded as a custom icon in a button.

 

I need to load an SVG that will serve as a partial background that will be dynamic (linked to bookmarks to hide/show) which is why I am not loading it in the Canvas background. However, as I stated above when I use a button (no action) and size the button to anything over ~550 pixels wide, the SVG stops scaling even though SVGs are technically infinitely scalable. I have played around with padding, to no avail. Something that is also annoying is there seems to be no way to position the SVG at the top of the button even though I have Text turned off.

 

I tried loading the SVG into an Image visual which does scale all the way up, but not having any experience with Image visuals, it seems to behave like it is interactable which I don't actually want. This SVG needs to serve as a background only.

 

So I am stuck on how to go about doing this in PBI.

 

Any hints? TIA!

1 ACCEPTED SOLUTION
xifeng_L
Super User
Super User

Hi @WishAskedSooner 

 

The use of the newly updated Image Visual can meet your needs. As for what you said about appearing interactive, I did not mention it here.

 

xifeng_L_1-1765252263341.png

 

You can create the measure and used in Image Visual, such as :

 

TechBG_BlueCyan = 
VAR ShowBackground = 1  // SELECTEDVALUE( Table[IsShow], 1 )
VAR SvgVisible =
    "<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900'>" &
    "<defs>" &
        "<linearGradient id='techGrad1' x1='0%' y1='0%' x2='100%' y2='100%'>" &
            "<stop offset='0%' stop-color='#0f172a' />" &
            "<stop offset='50%' stop-color='#0b3b5e' />" &
            "<stop offset='100%' stop-color='#06b6d4' />" &
        "</linearGradient>" &
    "</defs>" &
    "<rect width='100%' height='100%' fill='url(#techGrad1)' />" &
    "</svg>"

VAR SvgHidden =
    "<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900'>" &
    "<rect width='100%' height='100%' fill='transparent' />" &
    "</svg>"

RETURN
    "data&colon;image/svg+xml;utf8," &
    IF( ShowBackground = 1, SvgVisible, SvgHidden )

 

And , You can use the measure to control the hide/show, don't need bookmark.

 

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

View solution in original post

4 REPLIES 4
danextian
Super User
Super User

Hi @WishAskedSooner 

I find that SVG scales if you use viewbox.

danextian_1-1765276158090.gif

 

 

Please see the attached pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
alish_b
Skilled Sharer
Skilled Sharer

Hey @WishAskedSooner ,

 

Did you try using the Fill option instead of the Icon button in the Button under Style>Fill? It scales better than the Icon option. But if there was any other requirement that prevented that option, do let us know.

alish_b_0-1765253153043.png

 

Hope it helps!

xifeng_L
Super User
Super User

Hi @WishAskedSooner 

 

The use of the newly updated Image Visual can meet your needs. As for what you said about appearing interactive, I did not mention it here.

 

xifeng_L_1-1765252263341.png

 

You can create the measure and used in Image Visual, such as :

 

TechBG_BlueCyan = 
VAR ShowBackground = 1  // SELECTEDVALUE( Table[IsShow], 1 )
VAR SvgVisible =
    "<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900'>" &
    "<defs>" &
        "<linearGradient id='techGrad1' x1='0%' y1='0%' x2='100%' y2='100%'>" &
            "<stop offset='0%' stop-color='#0f172a' />" &
            "<stop offset='50%' stop-color='#0b3b5e' />" &
            "<stop offset='100%' stop-color='#06b6d4' />" &
        "</linearGradient>" &
    "</defs>" &
    "<rect width='100%' height='100%' fill='url(#techGrad1)' />" &
    "</svg>"

VAR SvgHidden =
    "<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900'>" &
    "<rect width='100%' height='100%' fill='transparent' />" &
    "</svg>"

RETURN
    "data&colon;image/svg+xml;utf8," &
    IF( ShowBackground = 1, SvgVisible, SvgHidden )

 

And , You can use the measure to control the hide/show, don't need bookmark.

 

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

All great answers! Thanks!

 

I tested the Image visual, and it is not interactive if Action is Off. I didn't realize the Image visual had been re-designed. I recall playing with it a while ago without the results I was looking for which is why I defaulted to a button. I really should stay more up to date on PBI developments.

 

@xifeng_L, I really like the suggestion of loading the SVG into a measure versus Bookmarks which I truly loathe.

 

Honestly, the fact that the Image visual has been re-designed is truly transformational. Good design is hard to achieve without SVGs. And a visual that can properly host them is a gamechanger.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors