LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

guidance with web services

hi all,

 

I have a VI which reads data from a IMU unit and displays data via a graph. I want to do a web app version of it with javascript. 

 

Would I have to extend the same VI as a new copy under web services to perform control from the browser or use a shared variable to convert the data into JSON and send to the browser for visualization

 

Thanks

0 Kudos
Message 1 of 5
(2,922 Views)

I saw this presentation at the most recent NI Week, and gives a nice overview of web services and how to integrate them in your application: https://decibel.ni.com/content/docs/DOC-42490

 

In terms of what you're asking, you're probably best breaking the app up into an acquisition VI, and a graph display VI. You could then add the web service as another type of display, sourcing the data from the acquisition VI in the same way the display VI does. Depending on what data you want to display, a shared variable would be a quick and easy starting point. If it turns out the variable is too lossy (your graph looks very steppy), you could use network streams or something similar.




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
0 Kudos
Message 2 of 5
(2,908 Views)

Take a look at the WebSockets link in my signature - it's a good way to send/receive data between a LabVIEW application and a web-browser with low-latency - which is ideal for displaying graph data!


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 3 of 5
(2,896 Views)

Thanks for replying. I tried using a shared variable and the result was, just as you mentioned, more or less stepped. Am I losing data by using a shared variable?

can network streams be used to pass data to the browser?

 

And do you know of a way to display graph on a browser such as in labview. I came across Google graphs API. Have to look into it though

 

Cheers

Gokul 

0 Kudos
Message 4 of 5
(2,841 Views)

Yes, shared variables store a 'snapshot' of the data - so you may lose data if you don't read the shared variable quickly enough.

 

No, you can't use network streams - the browser wouldn't understand the network streams protocol.

 

WebSockets with JSON is pretty much the only way I can think of doing this.

 

As for graphing, when I have done my WebSockets stuff I used flot.js - it's a nice looking graph API, it's pretty easy to use and covers most types of graphs we needed for our applications.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 5 of 5
(2,820 Views)