Forum Discussion

powertron's avatar
powertron
New Member
3 years ago

Showing Consistent Colors on a Graph Legend

Hi,

 

I have a bar graph which is showing values from a table, this graph has a date range which can be lowered/increased to show information over different timeframes.  Standard stuff so far.

When selecting data over "all time" there are 4 values represented on this graph : 

However when lowering the date range some ranges do not have all 4 values, so the legend/color scheme is changing : 

Is there a way to have a consistent "Light Blue = Completed" "Dark Blue = Not Started".... type value set anywhere so the graph has consistent colors no matter the values presented on it?

 

 

9 Replies

  • Hi,

     

    I experienced this as well & found the fix was to select Show items with no data

     

     

    This way when one field drops off due to having no data the colours will remain the same as it'll still be there in the legend bar

    • powertron's avatar
      powertron
      New Member

      Hi,

       

      I've tried this (assume I should be selecting this on the "Legend" value?) : 

      However the issue is the same.  If I select a date range where only 2 of the values are selected it shows one color scheme : 

      And this is not consistent when there are more values: 

      • LaurenceSD's avatar
        LaurenceSD
        Advocate II

        Is your legend data coming from a Fact or Dimension table? I'm guessing it's the former, if you put the legend data into a Dimension data and then create a 1 to many relationship, then the method mentioned above should work

  • MAwwad's avatar
    MAwwad
    Solution Sage

    Yes, you can manually set the colors for each category in the legend of your Power BI bar graph. Here's how to do it:

    1. Click on the bar graph visualization to select it.
    2. In the Visualizations pane, click on the Format tab.
    3. Expand the "Data colors" section.
    4. By default, the colors will be set to "Automatic". To set your own colors, click on "Custom colors".
    5. In the "Custom colors" section, click on the dropdown arrow next to the category you want to set a color for.
    6. Choose "Specific color" and select the color you want to use for that category.
    7. Repeat this process for each category in the legend.

    Once you have set the colors for each category, they will remain consistent regardless of the data being displayed.

    Note: If you add new categories to your data, you will need to manually set the colors for those categories as well.

    • powertron's avatar
      powertron
      New Member

      Hi,

       

      Clicking on the Graph and selecting the "Visualisation" option does not show a "Data Colors" option that I can see : 

       

      I've opened every sub menu and can't see anywhere to set Data Colors.

       

       

       

      • powertron's avatar
        powertron
        New Member

        Hi,

         

        The "Columns" data does have a "Colors" option but nothing to suggest I can turn on/turn off auto selection : 

         

    • Robert1981's avatar
      Robert1981
      Helper III

      I have stacked car chart with only top 7 selection. I know how to change the colors, but that is only for the initial selection. When I change slicer, I get different colors. How do I keep the colors consistent?