-
Notifications
You must be signed in to change notification settings - Fork 633
How to display Plotly R plot on Angular UI #1441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks to @jcheng5 for pointing me in the right direction here... Here's an outline of how this could work for htmlwidgets generally:
NOTE: For plotly, getting (1) right can be tricky. At least currently, I think this should work if you include all the dependencies when you run |
Closing since this is more of a development question rather than something that I can address in plotly directly |
Does |
Yes, good point, that adds the htmlwidgets.js file. I think that should also include dependencies under inst/htmlwidgets/plotly.yaml, but there currently aren't any listed there. |
Thanks, @cpsievert, @jcheng5 for your reply. We'll try it and then back to you. We hope this will work better. |
Issue: We use R as a backend and Angular for the frontend. We analyze the data in R and send a final output of data in JSON format to Angular. Then in Angular, we give import that data in plotly.js for plotting graphs.
But The statistical plots were incorrect because R plotly provides the functionality to use statistical functions directly for plotting and that’s why the plot becomes editable in a statistical way but plotly js does not support statistical functions and the plots are displayed in a simple line or bar graph. R plotly can also embed ggplot (a package used to plot analytical plots) as ggplotly but this functionality is provided only by R, not by Plotly JS.
Solutions that are tried :


a. Write the plotly code in R and return the plot’s HTML to Angular. Use inner HTML or iframe to
embed the HTML code. But Angular does accept JavaScript code in HTML.
b. Write the plotly code in R and return plotly json from R. directly assign the JSON to angular plotly
object. Not worked as R return the code in HTML widget form.
c. Write the plotly code in R and post the plot on URL of the widget present in Angular. Attach a link
to the box/widget where we need to show the graph and make it accessible from R. Not possible in
Angular to make a URL out of a widget.
d. How to show these statistical graphs in Angular UI
I Hope you will solve these issue. Thank you in advance.
The text was updated successfully, but these errors were encountered: