in controller
```
import plotly.express as px

def my_view():
    # Assuming df_dataframe is your Pandas DataFrame
    fig = px.line(df_dataframe, x="datetime", y="load_avg_fifteen")

    # Convert the figure to HTML
    plotly_chart = fig.to_html(full_html=False, include_plotlyjs='cdn')

    return dict(plotly_chart=plotly_chart)
```

in view

<!-- views/my_view.html -->
{{extend 'layout.html'}}

<div id="ovc_cpu_load_chart">
    {{=XML(plotly_chart)}}
</div>


It should work


On January 26, 2024 at 13:01:01, Jitun John (jitun.j...@gmail.com) wrote:

I would like to embed something on the following lines  import
plotly.express as px fig = px.line(df_dataframe, x="datetime",
y="load_avg_fifteen") show it in html page similar to
At present I am using HighCharts js, but as I totally work on pandas
dataframes.. I imagine it is far more efficient and easier using plotly. I
am trying to avoid a heck lot of Javascript code that I am not good with.
Chart should still be interactive.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAKC%3DaX6ftbRtjx%3Dc5sewSRpZ7n7kHESFJJfNmAxsGPZfYP3y%2BQ%40mail.gmail.com.

Reply via email to