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

Treemap coloring by category

Hi everyone.

 

I have treemap with data, item and category, where each item has two categories and data for categories. It looks like this:

Capture.PNG

I wanted to color by category, but in data colors there is no such options.

How I can color by category, so cat1 will be blue and cat2 will be yellow?

 

Regards,

Yerkhan

1 ACCEPTED SOLUTION
mwimberger
Resolver II
Resolver II

Hi @Anonymous 

 

Here is a solution that may work for you.

 

It involves a couple of things and doesn't keep the treemap formatted exactly as intended but it may be a small compromise if the shading is important. 

 

In the solution below, you keep item and category grouped under Group and then expand one level in the hierarchy in the visual ( the double arrow pitchfork icon). You need to have a column created which strips the Category from the Category name and create an advanced controls rule which controls the colour fill. I just used min 1 and max 2 , but if you have multiple categories you can use rules-based formatting too.

 

Bear in mind the advanced controls is not available with any field in the Details section 

Here are the steps:

 

2019-07-22_15-34-08.jpg

 

Cheers

 

Manfred

 

 

 

 

 

View solution in original post

11 REPLIES 11
v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

If you may try to exchange the item and category locations for Treemap.

BeforeBefore

2.JPG

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mwimberger
Resolver II
Resolver II

Hi @Anonymous 

 

Here is a solution that may work for you.

 

It involves a couple of things and doesn't keep the treemap formatted exactly as intended but it may be a small compromise if the shading is important. 

 

In the solution below, you keep item and category grouped under Group and then expand one level in the hierarchy in the visual ( the double arrow pitchfork icon). You need to have a column created which strips the Category from the Category name and create an advanced controls rule which controls the colour fill. I just used min 1 and max 2 , but if you have multiple categories you can use rules-based formatting too.

 

Bear in mind the advanced controls is not available with any field in the Details section 

Here are the steps:

 

2019-07-22_15-34-08.jpg

 

Cheers

 

Manfred

 

 

 

 

 

Thanks, mwimberger, this worked for me. It's a bit frustrating that the Power BI user interface for the Treemap visual makes it so difficult to apply a simple color gradient though. 

Anonymous
Not applicable

Hi @mwimberger 

 

Thanks for your answer.

Unfortunately, this doesn't quite works for me.

So, it is not possible to color with details present and make color by details, right?

 

Regards,

Yerkhan

Hi @Anonymous 

 

That right - as soon as you add a field to the details section , the advanced color formatting in Data Colors isn't available.

 

Another solution may be to use the Treemap Bar Chart custom visual from MAQ Software available in the marketplace or here https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA200000043?src=office&tab=Overview

 

2019-07-22_19-32-42.jpg

Hi @Anonymous 

 

Or you can try it this way...which might be exactly what you are after?

2019-07-23_13-27-20.jpg

Anonymous
Not applicable

@mwimberger 

 

In this example:

2019-07-23_13-27-20.jpg

How can I change border colors between items?

Regards,

Yerkhan

Hi @Anonymous 

So adding a border only adds a border to the visual outline. This is different to the MS Excel Treemap which adds a border to the items and you can adjust the thickness of these. (Maybe suggest this as an idea at ideas.powerbi.com) 

I tried a couple of things - the only thing that made a bit of a difference was changing background colour - which changed it only marginally using a black background. Here are some examples.

 

2019-07-24_9-45-36.jpg

So the built in tree map is not that customisable 😥.

Not sure whether you want to bake your own, or find other customisable ones ( there is a great list here: https://www.visualisingdata.com/resources/  with https://www.treemap.com offering an API or desktop version at a cost). Charticulator https://charticulator.com/index.html (which I mentioned earlier I think) has the following to say in its white paper https://donghaoren.org/publications/infovis18-charticulator.pdf :....." Besides, we can further extend Charticulator’s expressive range by supporting additional specialized layout algorithms (e.g., treemap and force-directed graph layout)". Not sure if that means it is still coming in a future release.

 

Hope this helps. 

 

Cheers and have an awesome day

Manfred

Hope I have been able to help in some small way 

Anonymous
Not applicable

@mwimberger @v-lili6-msft 

 

Thanks for your reply.

This approach doesn't quite work for me.

Are there any other tree map visuals? Besides regular tree map and bar charted tree map?

Regards,

Yerkhan

@Anonymous There is a Mekko Chart which does adjust the width of the bars based on a field. 

 

https://powerbi.microsoft.com/en-us/blog/visual-awesomeness-unlocked-mekko-chart/

 

https://appsource.microsoft.com/en-us/product/power-bi-visuals/wa104380785 

 

Here is an example with the data I used for the other tree maps.

2019-07-23_15-14-45.jpg

Or if that isn't up your alley you can look at baking your own - here is a great site:  https://charticulator.com/ 

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.