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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
MartinSlaa
Frequent Visitor

Publishing custom plotly animation gives an error

Hello!

I'm just starting to learn about custom visuals and R-scripting in Power BI. 

I have created a very simple animation using plotly which works fine in Power BI desktop. 

However, when I try to publish the report I get an error saying 


access to 'C:\Users\Client\Temp\RtmpM1YfAz\viewhtml1c546e16cc/index.html' denied.


Entier error can be seen in the picture below: 

MartinSlaa_0-1661951993855.png

R version used: 4.2.1
Plotly version used: 4.10.0
ggplot2 version used: 3.3.6

Here is the script used for the custom visual:

source('./r_files/flatten_HTML.r')

############### Library Declarations ###############
libraryRequireInstall("ggplot2");
libraryRequireInstall("plotly")
####################################################

################### Actual code ####################
library(plotly)

df <- data.frame(
x = c(1,2,1),
y = c(1,2,1),
f = c(1,2,3)
)

fig <- df %>%
plot_ly(
x = ~x,
y = ~y,
frame = ~f,
type = 'scatter',
mode = 'markers',
showlegend = F
)

fig
####################################################

############# Create and save widget ###############
p = ggplotly(fig);
internalSaveWidget(p, 'out.html');
####################################################

################ Reduce paddings ###################
ReadFullFileReplaceString('out.html', 'out.html', ',"padding":[0-9]*,', ',"padding":0,')
####################################################



Any help in resolving this issue would be much appreciated.
Thanks!

 

1 REPLY 1
dm-p
Super User
Super User

Hi @MartinSlaa,

When developing locally, R visuals will use the instance of R on your machine. As such, this will be able to resolve a file path that exists on your file system.

When you use an R visual in the Service, Power BI delegates the execution to a separate instance hosted by MS. As such, this will not know about your machine, or the files on it.

If you want to access an external file, you will need to host this in a location that can be accessed over HTTP, with no CORS restrictions (as custom visuals are hosted in sandboxed iframes and have their origin removed by the main window for security reasons).

Hopefully some of this may help you diagnose the issue and resolve.

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors