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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
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.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.