I am trying to speed up the display of Plotly plots by storing them as HTML as the prepared plots takes 10 to 20 secs to produce the charts in the first place. I have used plotly.io. code below: with a demo Iris chart
@anvil.server.callable
def create_fig():
data = px.data.iris()
fig = px.scatter(data, x=“sepal_width”, y=“sepal_length”, color=“species”,
trendline=“ols”)
chart_config = py.io.to_html(fig)
row = app_tables.chart_data.get(chart_name=‘Example’)
if row[‘chart_html’]:
row[‘chart_html’] = chart_config
else:
# Save it in the table - add new row
app_tables.chart_data.add_row(chart_name=“Example”,
chart_html=chart_config)
# Retrieve from the table
row = app_tables.chart_data.get(chart_name=“Example”)
html = row[‘chart_html’]
return html
What and how is the easiest way please to display html - HTML forms or iframe and how do I link the html form to HTML forms or iframes
I have tried using json but still slow to load and display.
Is there faster and better way please?