是否可以在R Script Visual of Power BI中使用R Plotly库?

有没有人尝试在Power Script的R Script Visual中使用Plotly或Highchart,

当我在R脚本编辑器中尝试此操作并运行:

library(ggplot2)
library(plotly)
x <- 1:5
y <- c(1, 3, 2, 3, 1)
plot_ly(x = dataset$period, y = dataset$mean, name = "spline", line = list(shape = "spline"))

错误信息:

No image was created. The R code did not result in creation of any visuals. Make sure your R script results in a plot to the R default device.

但在我的R桌面上运行完美.任何想法?

最佳答案 原因是目前Power BI仅支持由R可视化组件创建的渲染图表为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")
点赞