Skip to content

How to display Plotly R plot on Angular UI #3377

@kmaheshkulkarni

Description

@kmaheshkulkarni

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.

  1. 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

image
image

I Hope you will solve these issue. Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions