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
saikirann
Frequent Visitor

Host ColorPallet.getColor() not syncing colors across the dashboard

Hello,
I am assigning colors to each category using Host ColorPallet with `getColor` method. I have 2 pages with same categorical data being used but they will be filtered. The category color are not being synced on both pages when number of category data filtered. The color are being synced in inbuilt visuals like Line and Bar chart but in Custom Visual. Is there any other method or I am I missing something?   

4 REPLIES 4
saikirann
Frequent Visitor

When increasing the selections from slicer the color are getting repeated but when we refresh the page its giving saperate colors to all . Is there anyway to refresh the visual ?

v-shex-msft
Community Support
Community Support

HI @saikirann,

So you mean these setting only works on your custom visual instead of whole power bi visuals?
In my opinion, I suppose this part of properties not works on visuals that haven't configure these processings.

Add colors to your Power BI visuals - Power BI | Microsoft Docs

I'd like to suggest you use the theme file to apply the default 'data label' color sets instead.

Use report themes in Power BI Desktop - Power BI | Microsoft Docs

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Imagine this, I have 3 categories a,b,c. In one page user viewed all categories and in another page he filtered it to 1 category of 'c'. Now here the category colors for c is not matching in both pages even though they are same data. When user switches between the both pages color 'a' in first page and color 'c' in second page are same. Colors are being chosen as first color to first category basis. 

Hi @saikirann,

Visuals work independently of each other and have no knowledge of the data model, so colours will be assigned sequentially from the visual host's colorPalette object local to that visual. This is same behaviour for both core and custom visuals.

Therefore if you want colours to be consistent, you will need to data-bind them to instances of a visual, either by:

  • Adding a data role for a column containing a colour value that a user can add to your visual (which would be set in your dat amodel, either as a collumn or measure) and you can map to a data point, or:
  • Adding conditional formatting options for your users to assign a measure value (like how the core visuals manage it). Similarly, you manage the colour value using a column or a measure in your data model.

Regards,

Daniel





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)




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.