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

The Fabric community is upgrading! Read all of the details including the timeline and what you can expect. Learn more

Reply
SMG3397
Regular Visitor

Publishing Problems

The label positioning of report is changed.

       The parammeter direction="y" in R script visual doesn't seem to be working after publishing the report.

Although it works fine in Power BI desktop.

3 REPLIES 3
v-sihou-msft
Microsoft Employee
Microsoft Employee

@SMG3397

 

Can you share some screenshots and your R script?

 

Regards,

send2.PNGsend1.PNG

first image is screenshot of power bi desktop and second image is screenshot of power bi service.

The R script code is here:

library(ggplot2)
library(reshape2)
library(RColorBrewer)
library(ggrepel)
library(scales)
library(ggthemes)
 
set.seed(42)
getColors<-function(n){
   mypal<-colorRampPalette(brewer.pal(12, "Paired"))
   sample(mypal(n), n, replace=FALSE)
}
 
PropBarPlot<-function(df){
   melteddf<-melt(df, id=names(df)[1], na.rm=T)
   n<-length(levels(factor(melteddf$variable)))
 
   ggplot(melteddf, aes_string(x=names(df)[1])) + 
      geom_bar(data=melteddf,position="fill",stat="identity",width=0.06,aes(fill=variable,y=value))+
      labs(y="FAILURE",x="PRODUCT")+
      geom_text_repel(data=dataset,aes(label=dataLabel,x=Product,y=FinalFailure),direction="y",size=3.5,color="black",segment.size=0,check_overlap=TRUE,fontface="bold")+
      geom_point(data=dataset,aes(label=dataLabel,x=Product,y=FinalFailure),color="black")+
      scale_fill_manual(values=c("#FF0D00","#FF540A","#FFA600","#FFC100","#FFCB00","#FFDD00","#FFE200","#FFE900","#FFF100","#FFF300","#FDFF00","#FDFF00","#D9FF00","#A6FF00","#86FF00","#10FF00","#00FF43")) + 
      theme_classic(base_size=14)+
      guides(fill=FALSE)+
      coord_flip()+
      scale_y_continuous(limits=c(0,max(dataset$FinalFailure)),oob=rescale_none)
      
}
 
df <- data.frame(id=dataset$Product,
             val0=100,
             val1=1,
             val2=1, 
             val3=1, 
             val4=1, 
             val5=1, 
             val6=1, 
             val7=1,
             val8=1,
             val9=1,
             val10=5,
             val11=1,
             val12=1,
             val13=1,
             val14=1,
             val15=1,
             val16=1)
print(PropBarPlot(df))
 
Everything is working well in Power BI desktop but the overlapping text labels have been spread in Power BI online service. 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

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.