✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

How to display Plotly R plot on Angular UI

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 working 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
image
image
I Hope you will solve these issue. Thank you in advance.