I recently discovered an issue where custom visuals created with the pbiviz rhtml template simply don't work if you are using version 4.0.6 or 4.0.7 of pbiviz. You are able to create the template and successfully package the custom visual. However, when you import it into PBI Desktop it doesn't render anything; the 'thinking' dot wheel spins in the upper left corner for a moment when you add values and then the visual goes blank. After exhaustive troubleshooting, I looked into pbiviz version. I rolled back my version of powerbi-visuals-tools and created/packaged the rhtml template for pbiviz versions 4.0.2 to 4.0.7. Here are the results:
As we can see, the visual fails to render for versions 4.0.6+. Additionally, this issue exists without even changing the rhtml template R code. Notably, this issue appears to be isolated to some interaction between pbiviz/PBI and the R plotly package because custom visuals I created using the 'ggiraph' and 'networkD3' appear to work properly in the later versions of pbiviz. However, 'ggiraph' is not currently supported on PowerBI Service, so it is not a feasible alternative for users looking to publish reports that include interactive R plots. The only solution I've found is to use an earlier version of pbiviz.
I wanted to bring this to your attention as it took me several weeks to discover all this and reach a point where I could make working custom visuals (using pbiviz v4.0.5). Part of the problem is all the documentation suggests to users that the latest version of pbiviz should work, like this article on MS learn which specifically tells users to install the latest version of pbiviz: https://learn.microsoft.com/en-us/power-bi/developer/visuals/environment-setup?tabs=windows
Thank you for sharing, but it's more of a product design issue than a bug.
If you would like to suggest some feature or product improvements, you may vote the idea and comment here to improve this feature. It is a place for customers provide feedback about Microsoft Office products . What’s more, if a feedback is high voted there by other customers, it will be promising that Microsoft Product Team will take it into consideration when designing the next version in the future.