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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
SteiniJonsson
Frequent Visitor

Order of colors in R visual are wrong when published to service

I have a dataset which among other things defines colors which should be applied to columns in the visual.

This works really well in PBI desktop (and R Studio) but when I publish the report to powerbi.com the order of the colors is wrong (the columns get the wrong color).

At first it looked like the colors were sorted in alphabetical order but I was unable to reproduce that.

Using color names produced the same result as using the hex codes.

I have created a small DAX script to create test tables:

ColourNames = DataTable ( 
  "FillColour", string,
  "Value", integer,
  "xLabel", integer,
  {
    { "Red",  50, 1 },  
    { "Gold", 30, 2 },  
    { "Red",  10, 3 },  
    { "Gray", 40, 4 },  
    { "Red",  20, 5 }  
  }  
)  

ColourHexes = DataTable ( 
  "FillColour", string,
  "Value", integer,
  "xLabel", integer,
  {
    { "#ff0000", 50, 1 },  
    { "#ffd700", 30, 2 },  
    { "#ff0000", 10, 3 },  
    { "#bebebe", 40, 4 },  
    { "#ff0000", 20, 5 }  
  }  
)  

The R script for the visual is:

library(ggplot2)
ggplot( dataset, aes( x = xLabel, y = Value ) ) +
    geom_col ( fill = dataset$FillColour )

 

This is what the graph shold look like (and what it looks like in PBI desktop)...

SteiniJonsson_0-1647340368199.png

 

but in the service it looks like this.

SteiniJonsson_1-1647340433502.png

 

I'm running version 2.102.845.0 64-bit of PBI desktop.

Am I doing something wrong here or is this a bug in the service?

 

Regards,

Steini

 

2 REPLIES 2
Anonymous
Not applicable

Hi , @SteiniJonsson 

Could you share us with your pbix file(remove sensitive info) ? Maybe I can test it in my Service .

 

Best Regards,
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

You can download the file from https://github.com/SteiniMiracle/ColourOrder.

 

Regards,

Steini

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.