Jump to content

Any Plotly experts out there?


mje

Recommended Posts

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:

  1. 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.
  2. 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
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.

72fd5de393d50888ec7c119ea33f4cd8_f100.pn

Edited by ShaunR
Link to comment

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
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 by ShaunR
Link to comment
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

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.