Use Javascript to plot inside a Mendix widget.

Does anyone know if it is possible to use the Javascript snippet to create a Plotly graph?   I have a System.FileDocument object, containing a table. I want to get the location of the file from the object and display its contents in a chart.   I think maybe I can use Any Chart as well but the microflow to import the data from the .txt file and plot may be easier using Javascript directly.   Any thoughts appreciated.   <body> <script src=""></script> <script> function updatePlot(){ var tableData = { x: [1, 2, 3, 4, 5], y: [1, 4 ,9, 16, 25] } TABLE_DISPLAY = document.getElementById('table_display'); Plotly.newPlot( TABLE_DISPLAY, [{ x: tableData.x, y: tableData.y }], { margin: { t: 0 } } ); } </script> <meta charset="UTF-8"> <h1>Plotly can be used within Mendix</h1> <button onclick="updatePlot()">Plot Table</button> <div id="table_display" style="width:600px;height:250px;"></div> </body>
2 answers

Hi Martin,


This is always possible in the end. Not a good idea though in terms of effort and maintainability. I would suggest using one of the charting widgets Mendix offers. Did you take a look at the other charting widgets available?






this should be possible,  I would recommand to use a javascript action inside a nanoflow (as a dataview source nanoflow in your page) instead of the javascript snippet.

A javascript action allows you to use parameters, not a javascript snippet.