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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ozk_resg_prm
Frequent Visitor

Difference in R Visuals for PBI-Desktop and PBI-Service

Hello,

 

Does anyone know why the legend is not showing for my R Visual (ggplot2) in PBI-Service? Thanks.

 

library(ggplot2)
library(scales)
dd2 <- as.data.frame(unique(dataset$`Projected Date Text`))
colnames(dd2) <- c("ProjectedDate")
for(i in 1:length(dd2$ProjectedDate)){
       dd2$Actual[i] <- dataset$Sum5[as.character(dataset$`Projected Date Text`)== as.character(dataset$`As of Text`) & as.character(dd2$ProjectedDate[i]) == as.character(dataset$`Projected Date Text`)]
       dd2$Max[i] <- max(dataset$`Sum_Projected Amount`[as.character(dataset$`Projected Date Text`) == as.character(dd2$ProjectedDate[i])])
       dd2$Min[i] <- min(dataset$`Sum_Projected Amount`[as.character(dataset$`Projected Date Text`) == as.character(dd2$ProjectedDate[i])])}
dataset <- dd2
dataset$ProjectedDate <- as.Date(dataset$ProjectedDate, "%m/%d/%Y")
dataset <- dataset[order(dataset$ProjectedDate),]
ggplot(dataset, aes(x=ProjectedDate)) +
       geom_point(aes(y=Actual), color = "red", size=2.5) +
       geom_line(aes(y=Actual, color="Actual"), size=1.5) +
       geom_line(aes(y=Min, color = "Min Projection"), size=1.5) +
       geom_line(aes(y=Max, color = "Max Projection"), size=1.5) +
       geom_ribbon(aes(ymin=Min, ymax=Max), fill = "orange", alpha=0.4) +
       scale_y_continuous(name = "", labels = dollar_format()) +
       labs(x="Date") + 
       scale_color_manual(name=" ", values=c("Actual"= "red", "Min Projection"="blue", "Max Projection"="green")) +
       theme_bw(base_size = 16)

PBI-Desktop:

Capture.PNG

PBI-Service:

Capture2.PNG

3 REPLIES 3
v-yulgu-msft
Employee
Employee

Hi @ozk_resg_prm,

 

Would you please change to a different web browser for a test?

 

Regards,

Yuliana Gu

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

Hi @v-yulgu-msft,

 

Chrome and IE both swhow the same results.

ozk_resg_prm
Frequent Visitor

Has anyone experienced this before?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors