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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AEIOUandY
Frequent Visitor

Custom Icons - Can a girl get a polygon?

Good day! I'm trying to create polygons for downard and upward pointing arrows (I just don't like the colour options available in the default conditional formatting icon sets). The easiest way I could think of to do this is to add polygons to a json theme, but I cannot for the life of me get it to work. 

I have successfully used 

"data&colon;image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' x = '0px' y='0px' width='300' height='300' viewBox='0 0 100 100'> <circle cx='50' cy='50' r='40' stroke='darkgreen' stroke-width='4' fill='limegreen' /> </svg>" 

as a measure (along with three others) to create custom circle icons. I've plonked this into my json file and it has no problem adding the circles to the conditional formatting in my file. When I try to create a polygon svg though, not so much. 

 

I'm assuming I need to just change the svg portion <circle ... blah blah blah> and this is what I've tried:

<polygon points='1,1 150,300 300,1' stroke='darkgreen' stroke-width='1' fill='limegreen' />

 

Power BI does not like. I assume either it doesn't play nice with polygons or I have NO idea what I'm doing or both. Any advice to steer me in the right direction is appreciated. 

 

Thanks in advance, hivemind! 

😊

 

1 ACCEPTED SOLUTION

@AEIOUandY More than likely it is this:

"url": "data&colon;image/svg... The &colon; needs to be an actual colon

I created a bunch of these here: SVG Multi-Shape, Multi-Color Indicators - Microsoft Power BI Community

 

Also, MSHGQM includes a bunch of SVG measures that don't exhibit this issue with encoding : to &colon;

Microsoft Hearts Greg - YouTube


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
OwenAuger
Super User
Super User

Hi @AEIOUandY 

Yes, that's correct, essentially just replace <circle... /> with <polygon... /> 🙂

Perhaps there was a minor syntax error if Power BI was rejecting the theme.

 

In this particular case I would also recommending enlarging the viewBox to '0 0 300 300' so that the full polygon is visible.

 

Putting the following in a Theme JSON file just with the polygon icon definition worked for me

(change &colon; back to : as the forum messes this up)

 

{
	"name": "TestPolygon",
	"icons": {
        "MyPolygon": {
			"description": "My Polygon",
			"url":
			"data&colon;image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' x = '0px' y='0px' width='300' height='300' viewBox='0 0 300 300'> <polygon points='1,1 150,300 300,1' stroke='darkgreen' stroke-width='1' fill='limegreen' /> </svg>" 
		}
	}
}

 

 

 

OwenAuger_0-1653664055655.png

Are you able to get it working at your end?

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

I appreciate this help, Owen. I'm wondering what I'm missing in the style below to get this to work. When i use the syntax you provided in my measure it does generate the down arrow, but now I'd like to add this to the style I have set up and am obviously missing something. 

{ "name":"MyStyle",

"dataColors":["#00747A","#C90062","#FF7F45","#00B2A9","#AE7CCA","#F07691","#72CE9B","#53284F"],
"icons": {

"MyPolygon": {

"description": "My Polygon",
"url": "data&colon;image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' x = '0px' y='0px' width='300' height='300' viewBox='0 0 300 300'> <polygon points='1,1 150,300 300,1' stroke='darkgreen' stroke-width='1' fill='limegreen' /> </svg>"

}

}

}

@AEIOUandY More than likely it is this:

"url": "data&colon;image/svg... The &colon; needs to be an actual colon

I created a bunch of these here: SVG Multi-Shape, Multi-Color Indicators - Microsoft Power BI Community

 

Also, MSHGQM includes a bunch of SVG measures that don't exhibit this issue with encoding : to &colon;

Microsoft Hearts Greg - YouTube


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Oh my goodness, so grateful right now!! Thank you!

Helpful resources

Announcements
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.