Display REST Response String as HTML on Frontend

0
Hi there.  I am creating a small dashboard that displays graphs that inform a potential enduser as to weather forecasts.    I am fluent in Python and decided to use Plotly in combination with FastAPI to create a REST Service that Mendix may call and in return receive an HTML string that when rendered will created an interactive Plotly Graph.    So here's the flow: You click a button on Mendix It triggers a microflow that calls the FastAPI endpoint. That endpoint retrieves weather data and creates a graph. Plotly is smart enough to convert this graph into an HTML String.  I then pass this string via FastAPI back to Mendix where it is stored as a string in an Entity under the name "TemperatureForecast”. No problems so far.    Here is where the rubber hits the road, for the life of me, I am unable to get this HTML graph to display on the frontend.    I have tried the following widgets to no avail: HTMLElement I placed this in a dataview element with a connection to a microflow which retrieves the associated records with the stored HTML graph.  I set content to "HTML” Clicked "Edit” Passed the HTML String as a parameter to in the subsequent "Edit Caption” window. Making sure to write {1} in the caption window Upon viewing the app, and navigating to the correct page, no graph is physically rendered.  Using inspect element I cannot even find any hints of this HTML graph I add addition HTML to the caption box and these do show up. It seems as though the HTML graph is being stripped out somewhere downstream.  HTMLSnippet Does not appear to be able to be passed a string from the entity module HTMLSnippet with Context Same as HTML snippet   Short of writing my own widget for Mendix to achieve this action can anyone recommend me a widget/tool/walk me through how to use the existing tools.     
asked
1 answers
0

Hi Hamish,

 

Not the answer to “how to display plotly HTML string” but rather how to integrate plotly with Mendix. 

 

This is done using the AnyChart Module: https://marketplace.mendix.com/link/component/106517

 

See: https://docs.mendix.com/refguide/charts-any-configuration/

 

And: https://www.youtube.com/watch?v=SMzYrc9h6ZQ

 

Go Make It  

answered