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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Capstone
Resolver I
Resolver I

Changing legend colour by legend name

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Hi,

 

I have the following visual which is a small sample of a bigger visual im creating. I want to be able to automatically colour my legends based on their names. All the legend names end in either "Cl" or "Wst" and I want to make all "Cl"'s black and all "Wst"'s brown(or some other colour). I can do this manually when there are only a few legends. But I will have datasets where there might be 50 legends, Is there a way to automate this process ?

 

Abhi

5 REPLIES 5
Sean
Community Champion
Community Champion

@Capstone

Unfortunately as Phil said you can't do this however what you can do is place 2 charts next to each other

1 to aggregate and 1 to display the details

I created 2 columns to do this - 1 for the Aggregated data Legend and 1 basically your SeamName Column but in reverse order

this way the data will be grouped and sorted and thus easier to see Smiley Happy

 

Legend Name.gif

 

Hope this helps or at least gives you some ideas! Smiley Happy

 

EDIT: The above example had all the same data for B01, B02 ad B03

Here's with different data!

 

Legend Name2.gif

 

BTW you can also Edit the Interactions between the 2 Charts so they Filter instead of Highlight (as above) !

Hi Sean,

 

Thanks for the conditional column trick, it is a very handy one and I will definitely use it in the future.

 

Your method is good but I still want to show my original visual with the color coding described as I'm visualising a geological column with coal seams shown in black and waste bands shown in brown/orange. If the coal seams are coloured differently it just confuses people as the standared convention is that coal be shown in black.

 

Abhi

@Capstone

 

Currently, it's not supported to dynamically control the color of lenged with condition like start with "XX". We can only manually change the color assigned to each data point. I think @Sean's approach should be the most effective workaround. Please submit a feature request on idea: https://ideas.powerbi.com/forums/265200-power-bi-ideas

 

Regards,

Phil_Seamark
Employee
Employee

I don't think you can fix this programatically yet.  The API is getting expanded so this might be something we can do later in the year.

 

At the least, give the "format painter" feature a try.  You can apply some common properties between visuals quickly using this technique.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi Phil,

 

Thanks for your tip. I did give it a go but did not work for my visual. Will use that on other visuals and see it's effects.

 

Abhi

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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