Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI Anonymous,

    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

    • Anonymous's avatar
      Anonymous
      Not applicable

      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. 

      • dm-p's avatar
        dm-p
        Super User

        Hi Anonymous,

        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

  • Anonymous's avatar
    Anonymous
    Not applicable

    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 ?