JohnCoene / echarts4r

🐳 ECharts 5 for R
http://echarts4r.john-coene.com/
Other
585 stars 82 forks source link

shinyapp deployment error | themes #587

Closed antoine4ucsd closed 8 months ago

antoine4ucsd commented 8 months ago

Hello Not sure if there is an easy fix but I created an app that works just fine locally with several nice echarts plot the deployment went welll but the app is not running online (error) I checked the log:

Error in value[[3L]]: Couldn't normalize path in `addResourcePath`, with arguments: `prefix` = 'shine-1.0.0'; `directoryPath` = '/Users/me/Library/R/x86_64/4.2/library/echarts4r/htmlwidgets/lib/echarts-4.8.0/themes'

is there a fix? it may have been addressed elsewhere but cannot find it. I used shine theme for most plots

thank you!

JohnCoene commented 8 months ago

I think that was a bug in {htmlwidgets}, can you reinstall it and try again? Is it via shinyapps.io?

install.packages("htmlwidgets")
antoine4ucsd commented 8 months ago

trying now. thank you!

antoine4ucsd commented 8 months ago

I added the above line in my code and specifically call the htmlwidgets library but this is still looking for a local path not sure how to handle this. really sorry

2023-11-08T08:14:46.657309+00:00 shinyapps[10454283]: Warning: Error in value[[3L]]: Couldn't normalize path in `addResourcePath`, with arguments: `prefix` = 'shine-1.0.0'; `directoryPath` = '/Users/me/Library/R/x86_64/4.2/library/echarts4r/htmlwidgets/lib/echarts-4.8.0/themes'
antoine4ucsd commented 8 months ago

attaching the 2 logs with and without the install.packages within the code. miami_dashboard-logs.txt miami2-logs.txt

JohnCoene commented 8 months ago

Where do you deploy this app?

The paths in there seems to be local paths on Windows machines...

antoine4ucsd commented 8 months ago

I agree . I am deploying the app from my laptop but it is submitted to shinyapps.io. I think I understand why now... I saved outputs that are called directly within the apps. bummer. I will have to go with a different strategy I guess. I will start from scratch and keep you posted. sorry for wasting your time. thank you!

JohnCoene commented 8 months ago

No worries but why are you storing plots locally? You should not need to do that, and even if you do you can make it work.

Use relative paths instead of normalised hardcoded path.

# good
./img.png

# bad
/User/me/img.png
antoine4ucsd commented 8 months ago

I know. I am not storing the plot itself but the RDS of the echart output. I think this is a stupid habit...

antoine4ucsd commented 8 months ago

I confirm that was it! may I ask one more thing... is there a way to increase the height of the echarts4rOutput generated with render renderEcharts4r? see for example:

image

I can increase the size of the box but not the plot itself. thank you for your patience.

JohnCoene commented 8 months ago

Yes here: https://echarts4r.john-coene.com/reference/echarts4r-shiny

antoine4ucsd commented 8 months ago

wahoo. I just tried: I confirm it works. sorry for keeping you busy but it looks like nothing is impossible so far. thank you!