mje Posted November 7, 2016 Report Share Posted November 7, 2016 Are there any plotly experts out there that have had experience integrating it into LabVIEW which would care to lend an ear? I've dabbled with it for a day or two and am convinced it can provide some solid data visualization options that overcomes a lot of the limitations the native rendering tools in LabVIEW burden us with. As I see it there's two paths to getting plotly data rendered in a LabVIEW application: Use Python to leverage plotly's offline capabilities to render static images and dump them in into a picture control. While this would produce visualization beyond LabVIEW's current capacity with relative ease, I'm skeptical I can get enough data out of plotly for this to work since I'd be expected to provide context sensitive data based on cursor position and clickable data points. Host an HTML context in LabVIEW and dump everything into plotly.js. This would be a significant amount of work to get data in and out of the hosted context but I've done so in the past. I frankly see this as a very ugly option. Has anyone looked into plotly or other alternative rendering libraries? I also looked at the Advanced Plotting Toolkit but it seems to also lack an obvious way to extract context from the resulting images-- I need to translate cursor location to data points. I also can't bang a fast enough render time out of it to be useful. -m Link to comment
ShaunR Posted November 8, 2016 Report Share Posted November 8, 2016 (edited) 4 hours ago, mje said: Has anyone looked into plotly or other alternative rendering libraries? I investigated some but not plotly. I settled on flot for the Websocket API for LabVIEW and it is the API used for the Dashboard example . Raphael was a close second but it is more generic in drawing vector graphics as opposed to just graphing/plotting so is harder to use. I have mentioned before that I now use browsers exclusively for LabVIEW UIs so if the main attraction is the data sharing aspect of the plotly online service or if you are constrained by it appearing on your FP, then it's probably not what you are looking for. If it is for creating superior graphs then it is perfect. Edited November 8, 2016 by ShaunR Link to comment
mje Posted November 8, 2016 Author Report Share Posted November 8, 2016 Agreed, until the stale nature of the NI platform changes I don't see considering it for serious UI work any time soon. I need an entirely offline solution, and although the main draw of plotly is the online sharing aspect, it still has rather capable offline code. For all I know the rendering may be handled by a more appropriate lower level library that I can use directly. I just haven't had the time to peel back that onion yet. Kudos for the recommendations, Shaun. Link to comment
ShaunR Posted November 8, 2016 Report Share Posted November 8, 2016 (edited) 17 minutes ago, mje said: Agreed, until the stale nature of the NI platform changes I don't see considering it for serious UI work any time soon. I need an entirely offline solution, and although the main draw of plotly is the online sharing aspect, it still has rather capable offline code. For all I know the rendering may be handled by a more appropriate lower level library that I can use directly. I just haven't had the time to peel back that onion yet. Kudos for the recommendations, Shaun. I'm not sure what you mean by "entirely offline". Javascript libraries can be loaded in any browser off of of the local file system so online servers are just the delivery mechanism for the Javascript code. Dynamically updating the variables in that Javascript has a number of options from Websockets, WebRTP, the local NI Webserver and so on. If push came to shove, you can use the .NET Internet Explorer browser control on the front panel and pretend it is just a graph control. Edited November 8, 2016 by ShaunR Link to comment
mje Posted November 8, 2016 Author Report Share Posted November 8, 2016 10 minutes ago, ShaunR said: I'm not sure what you mean by "entirely offline". I mean I can't contact any remote server. Keeping everything on the localhost, directly manipulating the hosted document-- that's all fine. "Web" technologies aren't off limits, I just can't generate network traffic. If the application pokes the outside world it can't be used by some of our customers. Link to comment
Omar Mussa Posted November 9, 2016 Report Share Posted November 9, 2016 I'm using plotly right now in an offline project (via the JS API) for displaying data parsed from csv data files on a Windows (10) machine. I embed a .NET browser on a VI and load a very basic html file that runs some javascript. From there, the way I see it there are two pathways: 1 - Run a local http server where the data folder is so that you can get the files through AJAX calls to get the file data. 2 - And I know this sucks but - utilize ActiveX so that you can use the file scripting object to read data files. I have my code setup to poll a specific file for date changed and if changed then to parse it and load it onto the plotly graph. The benefit of option 2 is that you don't need to manage a web server. In order to make it work I have set the local machine as a trusted site and set the trusted site security to allow ActiveX. I went that route because I didn't want to manage an http server on my machine but YMMV. The end result is that I'm using the 3D plot to generate really great looking graphs as data is acquired and the graphing code can be reused in future data vis. applications. No web connection needed. Link to comment
Omar Mussa Posted November 9, 2016 Report Share Posted November 9, 2016 Also - since you're using python for the data processing you can use python's web server and avoid the legacy nightmare that is ActiveX. 1 Link to comment
mje Posted November 10, 2016 Author Report Share Posted November 10, 2016 Indeed. I also believe the .NET interface exposes the window object (which is the global javascript scope) along with the contained document object. Well it did back in the MFC days... .NET wasn't really a thing last time I did something like this. Using the python server would also allow me to create some sync objects in that scope to push data through application boundaries. Would still need to poll though. Either way, this seems like a lot of work. I'm doubtful I'll have enough of a time budget to explore such a thing given how little reuse something like this would see. Link to comment
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now