简体   繁体   中英

R visuals not producing graphs in power bi

I am trying to create some R visuals in Power BI using the googleVis and/or plotly libraries, but no matter what I do, I can't get Power BI to display anything. It always just says “No image was created. The R code didn't result in creation of any visuals. Make sure your R script results in a plot to the R default device.” The issue occurs with plotly and googleVis libraries, so I think it may have something to do with the fact that they're both browser-based outputs. Per Microsoft, plotly is supported in Power BI . I was hoping someone could tell me why I can't get any of these example scripts to work in Power BI.

Example code which works in R, but not pbi.

plotly

library(plotly)
p <- plot_ly(midwest, x = ~percollege, color = ~state, type = "box")
p

googleVis

df=data.frame(country=c("US", "GB", "BR"), 
              val1=c(10,13,14), 
              val2=c(23,12,32))

Line <- gvisLineChart(df)
plot(Line)

Now, we can create RHTML custom visual in power BI

1) we can use Ploty - to use it you have load you "midwest" data in power BI table

2) then drag it to R script so it will available to R Script .

3) then run R script , it will work

You can render charts created by plotly as PNG:

p <- plot_ly(x = dataset$period, y = dataset$mean, name = "spline", line = list(shape = "spline"))
plotly_IMAGE(p, format = "png", out_file = "out.png")

But the problem with this is that, though rendered by plotly, the visualizations will not be interactive since it's just a PNG image.

If you want to create interactive visualizations using plotly. The only way you can do so far is to create a custom Power BI visualization and import it to your report. See this post for a good introduction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM